File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -307,7 +307,8 @@ class TestOther : public TestFixture {
307307 TEST_CASE(knownConditionFloating);
308308 TEST_CASE(knownConditionPrefixed);
309309
310- TEST_CASE(ternarySameValuePlatformDependent); // #13773
310+ TEST_CASE(ternarySameValuePlatformDependent1); // #13773
311+ TEST_CASE(ternarySameValuePlatformDependent2); // #23773
311312 }
312313
313314#define check(...) check_(__FILE__, __LINE__, __VA_ARGS__)
@@ -13096,18 +13097,21 @@ class TestOther : public TestFixture {
1309613097 errout_str());
1309713098 }
1309813099
13099- void ternarySameValuePlatformDependent () // #13773
13100+ void ternarySameValuePlatformDependent1 () // #13773
1310013101 {
13101- check("typedef float _Complex complex_f32;\n"
13102- "typedef struct {\n"
13103- " uint16_t real;\n"
13104- " uint16_t imag;\n"
13105- "} packed_complex;\n"
13106- "void foo(void) {\n"
13107- " b = a ? sizeof(packed_complex) : sizeof(complex_f32);\n"
13102+ check("void f(void) {\n"
13103+ " b = a ? sizeof(unsigned int) : sizeof(uint32_t);\n"
1310813104 "}\n");
1310913105 ASSERT_EQUALS("", errout_str());
1311013106 }
13107+
13108+ void ternarySameValuePlatformDependent2() // #13773
13109+ {
13110+ check("void f(void) {\n"
13111+ " b = a ? sizeof(uint32_t) : sizeof(uint32_t);\n"
13112+ "}\n");
13113+ ASSERT_EQUALS("[test.cpp:2:30]: (style) Same expression in both branches of ternary operator. [duplicateExpressionTernary]\n", errout_str());
13114+ }
1311113115};
1311213116
1311313117REGISTER_TEST(TestOther)
You can’t perform that action at this time.
0 commit comments