Skip to content

Commit 0faaf14

Browse files
Update testcondition.cpp
1 parent e93fb9c commit 0faaf14

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test/testcondition.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4787,6 +4787,19 @@ class TestCondition : public TestFixture {
47874787
" }\n"
47884788
"}\n");
47894789
ASSERT_EQUALS("", errout_str());
4790+
4791+
check("struct S {\n" // #14392
4792+
" bool g() const { return m; }\n"
4793+
" bool m{};\n"
4794+
"};\n"
4795+
"void f(S s) {\n"
4796+
" if (s.g()) {\n"
4797+
" bool b = s.g();\n"
4798+
" return b;\n"
4799+
" }\n"
4800+
" return false;\n"
4801+
"}\n");
4802+
ASSERT_EQUALS("[test.cpp:6:12] -> [test.cpp:7:21]: (style) Condition 's.g()' is always true [knownConditionTrueFalse]\n", errout_str());
47904803
}
47914804

47924805
void alwaysTrueSymbolic()

0 commit comments

Comments
 (0)