From 1881898e677920a869f888a2c1c5e8057a1b6ee4 Mon Sep 17 00:00:00 2001 From: Alexander Mai Date: Fri, 19 Oct 2012 20:04:43 +0200 Subject: [PATCH] Added unit test for #4290 --- test/testclass.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/testclass.cpp b/test/testclass.cpp index 7d0f3afd7..f51b57d3d 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -161,6 +161,8 @@ private: TEST_CASE(initializerListOrder); TEST_CASE(initializerListUsage); + + TEST_CASE(forwardDeclaration); // ticket #4290/#3190 } void checkCopyConstructor(const char code[]) { @@ -5398,6 +5400,22 @@ private: "};"); ASSERT_EQUALS("[test.cpp:3]: (performance) Variable 'a' is assigned in constructor body. Consider performing initialization in initialization list.\n", errout.str()); } + + // ticket #4290 "False Positive: style (noConstructor): The class 'foo' does not have a constructor." + // ticket #3190 "SymbolDatabase: Parse of sub class constructor fails" + void forwardDeclaration() { + checkConst("class foo;\n" + "int bar;\n"); + ASSERT_EQUALS("", errout.str()); + + checkConst("class foo;\n" + "class foo;\n"); + ASSERT_EQUALS("", errout.str()); + + checkConst("class foo{};\n" + "class foo;\n"); + ASSERT_EQUALS("", errout.str()); + } }; REGISTER_TEST(TestClass)