diff --git a/testUninitVar1/err.msg b/testUninitVar1/err.msg deleted file mode 100644 index d86b2a665..000000000 --- a/testUninitVar1/err.msg +++ /dev/null @@ -1 +0,0 @@ -[testUninitVar1\testUninitVar1.cpp:17] Uninitialized member variable 'Fred::_i' diff --git a/testUninitVar1/testUninitVar1.cpp b/testUninitVar1/testUninitVar1.cpp deleted file mode 100644 index 21d6b645a..000000000 --- a/testUninitVar1/testUninitVar1.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -class Fred -{ -private: - int _i; -public: - Fred(); - Fred(int); -} - -Fred::Fred() -{ - _i = 0; -} - -Fred::Fred(int i) -{ } diff --git a/tests.cpp b/tests.cpp index 93e0b21ec..50ab9b500 100644 --- a/tests.cpp +++ b/tests.cpp @@ -176,8 +176,9 @@ static void buffer_overrun() static void constructors() { // Test1: No constructor => Uninitialized variable (TODO) - // Test2: Uninitialized variable (TODO) + // Test2: embedded constructor, uninitialized variable (TODO) // Test3: Uninitialized variable + // Test4: multiple constructors, uninitialized variable const char test1[] = "class clKalle\n" "{\n" @@ -209,6 +210,22 @@ static void constructors() "{ }\n"; check( CheckConstructors, __LINE__, test3, "[test.cpp:8] Uninitialized member variable 'clKalle::i'\n" ); + + const char test4[] = "class clKalle\n" + "{\n" + "public:\n" + " clKalle();\n" + " clKalle(int _i);\n" + " int i;\n" + "};\n" + "clKalle::clKalle()\n" + "{ }\n" + "clKalle::clKalle(int _i)\n" + "{\n" + " i = _i;\n" + "}\n"; + check( CheckConstructors, __LINE__, test4, "[test.cpp:9] Uninitialized member variable 'clKalle::i'\n" ); + } //---------------------------------------------------------------------------