From b4b636b6a270857e9491d847fbe43f828e5481d6 Mon Sep 17 00:00:00 2001 From: Simon Martin Date: Sat, 29 Aug 2015 13:11:00 +0200 Subject: [PATCH] Ticket #6959: Properly handle arrays of pointers in CheckClass::constructors. --- lib/checkclass.cpp | 2 +- test/testconstructors.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index a248f7b61..660a84e9d 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -160,7 +160,7 @@ void CheckClass::constructors() } // Check if type can't be copied - if (!var->isPointer() && var->typeScope()) { + if (!var->isPointer() && !var->isPointerArray() && var->typeScope()) { if (func->type == Function::eMoveConstructor) { if (canNotMove(var->typeScope())) continue; diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 02f22fef9..f643a875e 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -148,7 +148,7 @@ private: TEST_CASE(uninitVarArray6); TEST_CASE(uninitVarArray7); TEST_CASE(uninitVarArray8); - TEST_CASE(uninitVarArray9); // ticket #6957 + TEST_CASE(uninitVarArray9); // ticket #6957, #6959 TEST_CASE(uninitVarArray2D); TEST_CASE(uninitVarArray3D); TEST_CASE(uninitVarCpp11Init1); @@ -2414,6 +2414,15 @@ private: " IxExprListT() {}\n" "};"); ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'IxExprListT::eArr' is not initialized in the constructor.\n", errout.str()); + check("struct sRAIUnitDefBL {\n" + " sRAIUnitDefBL();\n" + " ~sRAIUnitDefBL();\n" + "};\n" + "struct sRAIUnitDef {\n" + " sRAIUnitDef() {}\n" + " sRAIUnitDefBL *List[35];\n" + "};"); + ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'sRAIUnitDef::List' is not initialized in the constructor.\n", errout.str()); } void uninitVarArray2D() {