From 4225544c82e246a381008a9eabc3fb357255767a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 2 Apr 2010 19:10:05 +0200 Subject: [PATCH] Added TODO test case to reduce false negatives for uninitialized class members --- test/testclass.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/testclass.cpp b/test/testclass.cpp index ea1abdeaa..cf0253f6f 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -1149,6 +1149,7 @@ private: void uninitVar3() { + // No FP when struct has constructor checkUninitVar("class Foo\n" "{\n" "public:\n" @@ -1160,6 +1161,20 @@ private: " Bar bars[2];\n" "};\n"); ASSERT_EQUALS("", errout.str()); + + // Using struct that doesn't have constructor + checkUninitVar("class Foo\n" + "{\n" + "public:\n" + " Foo() { }\n" + "private:\n" + " struct Bar {\n" + " int x;\n" + " };\n" + " Bar bars[2];\n" + "};\n"); + TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Member variable not initialized in the constructor 'Foo::bars'\n", errout.str()); + ASSERT_EQUALS("", errout.str()); // So we notice if something is reported. } void uninitVar4()