Skip to content

Commit dce479d

Browse files
Update testother.cpp
1 parent 9d32249 commit dce479d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

test/testother.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12651,6 +12651,24 @@ class TestOther : public TestFixture {
1265112651
" }\n"
1265212652
"}\n");
1265312653
ASSERT_EQUALS("[test.cpp:4:36]: (warning) Access of moved variable 'l'. [accessMoved]\n", errout_str());
12654+
12655+
check("struct S {\n" // #13179
12656+
" operator bool() const { return !m.empty(); }\n"
12657+
" std::string m;\n"
12658+
"};\n"
12659+
"S get();\n"
12660+
"void set(S);\n"
12661+
"void f() {\n"
12662+
" while (S s = get()) {\n"
12663+
" set(std::move(s));\n"
12664+
" }\n"
12665+
"}\n"
12666+
"void g() {\n"
12667+
" while (S s{ get() }) {\n"
12668+
" set(std::move(s));\n"
12669+
" }\n"
12670+
"}\n");
12671+
ASSERT_EQUALS("", errout_str());
1265412672
}
1265512673

1265612674
void moveCallback()

0 commit comments

Comments
 (0)