We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 04af809 commit 388afe6Copy full SHA for 388afe6
1 file changed
test/testunusedvar.cpp
@@ -271,6 +271,8 @@ class TestUnusedVar : public TestFixture {
271
TEST_CASE(globalData);
272
273
TEST_CASE(structuredBinding); // #13269
274
+
275
+ TEST_CASE(pointerCast); // #14535
276
}
277
278
struct FunctionVariableUsageOptions
@@ -7308,6 +7310,15 @@ class TestUnusedVar : public TestFixture {
7308
7310
"}\n");
7309
7311
ASSERT_EQUALS("", errout_str());
7312
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
+ }
7322
};
7323
7324
REGISTER_TEST(TestUnusedVar)
0 commit comments