We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9d32249 commit dce479dCopy full SHA for dce479d
1 file changed
test/testother.cpp
@@ -12651,6 +12651,24 @@ class TestOther : public TestFixture {
12651
" }\n"
12652
"}\n");
12653
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
12669
12670
+ "}\n");
12671
+ ASSERT_EQUALS("", errout_str());
12672
}
12673
12674
void moveCallback()
0 commit comments