Skip to content

Commit ba465f5

Browse files
Update testcondition.cpp
1 parent c7810db commit ba465f5

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
@@ -110,6 +110,7 @@ class TestCondition : public TestFixture {
110110
TEST_CASE(alwaysTrueContainer);
111111
TEST_CASE(alwaysTrueLoop);
112112
TEST_CASE(alwaysTrueTryCatch);
113+
TEST_CASE(alwaysTrueSideEffect);
113114
TEST_CASE(multiConditionAlwaysTrue);
114115
TEST_CASE(duplicateCondition);
115116

@@ -5590,6 +5591,18 @@ class TestCondition : public TestFixture {
55905591
ASSERT_EQUALS("", errout_str());
55915592
}
55925593

5594+
void alwaysTrueSideEffect() {
5595+
check("bool check(const char* const);\n" // #14416
5596+
"void create(const char*);\n"
5597+
"void f(const char* n) {\n"
5598+
" if (!check(n)) {\n"
5599+
" create(n);\n"
5600+
" if (check(n)) {}\n"
5601+
" }\n"
5602+
"}\n");
5603+
ASSERT_EQUALS("", errout_str());
5604+
}
5605+
55935606
void multiConditionAlwaysTrue() {
55945607
check("void f() {\n"
55955608
" int val = 0;\n"

0 commit comments

Comments
 (0)