Skip to content

Commit 388afe6

Browse files
committed
Add test
1 parent 04af809 commit 388afe6

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/testunusedvar.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ class TestUnusedVar : public TestFixture {
271271
TEST_CASE(globalData);
272272

273273
TEST_CASE(structuredBinding); // #13269
274+
275+
TEST_CASE(pointerCast); // #14535
274276
}
275277

276278
struct FunctionVariableUsageOptions
@@ -7308,6 +7310,15 @@ class TestUnusedVar : public TestFixture {
73087310
"}\n");
73097311
ASSERT_EQUALS("", errout_str());
73107312
}
7313+
7314+
void pointerCast() { // #14535
7315+
functionVariableUsage("void f(int* p)\n"
7316+
"{\n"
7317+
" int* p2 = p;\n"
7318+
" ((int *)(p2))[0] = 0; // remove cast for warning to disappear\n"
7319+
"}\n");
7320+
ASSERT_EQUALS("", errout_str());
7321+
}
73117322
};
73127323

73137324
REGISTER_TEST(TestUnusedVar)

0 commit comments

Comments
 (0)