From 5bc74d349657a5dd0b03dfbe8f966dda02986151 Mon Sep 17 00:00:00 2001 From: chrchr Date: Thu, 22 Sep 2022 17:49:05 +0200 Subject: [PATCH 1/2] Add test for #11177 --- test/testconstructors.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 88516f2dae3..0996c928aca 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -4333,6 +4333,14 @@ class TestConstructors : public TestFixture { "template\n" "A>::A() : m_value(false) {}"); ASSERT_EQUALS("", errout.str()); + + check("template struct S;\n" // #11177 + "template <> struct S final {\n" + " explicit S(int& i);\n" + " int& m;\n" + "};\n" + "S::S(int& i) : m(i) {}\n"); + ASSERT_EQUALS("", errout.str()); } void unknownTemplateType() { From b587d8cade9ad0275cf8a2a720c3a637b65782cf Mon Sep 17 00:00:00 2001 From: chrchr Date: Thu, 22 Sep 2022 17:53:38 +0200 Subject: [PATCH 2/2] Add test for #6504 --- test/testincompletestatement.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index c124c49f430..41f783ad4c7 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -696,6 +696,12 @@ class TestIncompleteStatement : public TestFixture { ASSERT_EQUALS("[test.cpp:2]: (warning) Redundant code: Found a statement that begins with NULL constant.\n" "[test.cpp:3]: (warning) Redundant code: Found a statement that begins with NULL constant.\n", errout.str()); + + check("struct S { int i; };\n" // #6504 + "void f(S* s) {\n" + " (*s).i;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:3]: (warning) Redundant code: Found unused member access.\n", errout.str()); } void vardecl() {