Skip to content

Commit

Permalink
Add test for #12391 (#6621)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Jul 21, 2024
1 parent 91bc449 commit 4de8325
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 @@ -5684,6 +5684,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 4de8325

Please sign in to comment.