Skip to content

Commit

Permalink
Add test for #12391
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Jul 21, 2024
1 parent 76f1aac commit 59cf0ba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/testcondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5678,6 +5678,15 @@ class TestCondition : public TestFixture {
"}\n");
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) The if condition is the same as the previous if condition\n", errout_str());

check("struct S { int x; };\n" // #12391
"int f(const struct S* a, const struct S* b) {\n"
" const struct S* p = b;\n"
" if (a->x < p->x) p++;\n"
" if (a->x < p->x) p++;\n"
" return p->x;\n"
"}\n");
ASSERT_EQUALS("", errout_str());

// do not crash
check("void assign(const MMA& other) {\n"
" if (mPA.cols != other.mPA.cols || mPA.rows != other.mPA.rows)\n"
Expand Down

0 comments on commit 59cf0ba

Please sign in to comment.