From 158238ad4b6fcad8766efecec8b6ea312e4ae68a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Thu, 17 Dec 2015 14:08:24 +0100 Subject: [PATCH] add testcase for #7179 (see bebf8cc ) --- test/testunusedvar.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/testunusedvar.cpp b/test/testunusedvar.cpp index 258ac0b9e..b53335549 100644 --- a/test/testunusedvar.cpp +++ b/test/testunusedvar.cpp @@ -47,6 +47,7 @@ private: TEST_CASE(structmember_extern); // No false positives for extern structs TEST_CASE(structmember10); TEST_CASE(structmember11); // #4168 - initialization with {} / passed by address to unknown function + TEST_CASE(structmember12); // #7179 - FP unused structmember TEST_CASE(localvar1); TEST_CASE(localvar2); @@ -392,6 +393,26 @@ private: TODO_ASSERT_EQUALS("abc::x is not used", "", errout.str()); } + void structmember12() { // #7179 + checkStructMemberUsage("#include \n" + "struct\n" + "{\n" + " union\n" + " {\n" + " struct\n" + " {\n" + " int a;\n" + " } struct1;\n" + " };\n" + "} var = {0};\n" + "int main(int argc, char *argv[])\n" + "{\n" + " printf(\"var.struct1.a = %d\n\", var.struct1.a);\n" + " return 1;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + void structmember_extern() { // extern struct => no false positive checkStructMemberUsage("extern struct AB\n"