File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,6 +201,7 @@ class TestOther : public TestFixture {
201201 TEST_CASE(duplicateExpression19);
202202 TEST_CASE(duplicateExpression20);
203203 TEST_CASE(duplicateExpression21);
204+ TEST_CASE(duplicateExpression22);
204205 TEST_CASE(duplicateExpressionLoop);
205206 TEST_CASE(duplicateValueTernary);
206207 TEST_CASE(duplicateValueTernarySizeof); // #13773
@@ -8358,6 +8359,22 @@ class TestOther : public TestFixture {
83588359 ASSERT_EQUALS("", errout_str());
83598360 }
83608361
8362+ void duplicateExpression22() {
8363+ check("int f() {\n" // #14913
8364+ " return 0x1 | (0x2 | 0x4) | 0x1;\n"
8365+ "}\n"
8366+ "int g() {\n"
8367+ " return 0x1 | (0x2 | 0x1);\n"
8368+ "}\n"
8369+ "int h() {\n"
8370+ " return 0x1 | (0x1 | 0x2);\n"
8371+ "}\n");
8372+ ASSERT_EQUALS("[test.cpp:2:30]: (style) Same expression '0x1' found multiple times in chain of '|' operators. [duplicateExpression]\n"
8373+ "[test.cpp:5:23]: (style) Same expression '0x1' found multiple times in chain of '|' operators. [duplicateExpression]\n"
8374+ "[test.cpp:8:23]: (style) Same expression '0x1' found multiple times in chain of '|' operators. [duplicateExpression]\n",
8375+ errout_str());
8376+ }
8377+
83618378 void duplicateExpressionLoop() {
83628379 check("void f() {\n"
83638380 " int a = 1;\n"
You can’t perform that action at this time.
0 commit comments