Ticket #6959: Properly handle arrays of pointers in CheckClass::constructors.

This commit is contained in:
Simon Martin 2015-08-29 13:11:00 +02:00
parent 08413f0112
commit b4b636b6a2
2 changed files with 11 additions and 2 deletions

View File

@ -160,7 +160,7 @@ void CheckClass::constructors()
} }
// Check if type can't be copied // 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 (func->type == Function::eMoveConstructor) {
if (canNotMove(var->typeScope())) if (canNotMove(var->typeScope()))
continue; continue;

View File

@ -148,7 +148,7 @@ private:
TEST_CASE(uninitVarArray6); TEST_CASE(uninitVarArray6);
TEST_CASE(uninitVarArray7); TEST_CASE(uninitVarArray7);
TEST_CASE(uninitVarArray8); TEST_CASE(uninitVarArray8);
TEST_CASE(uninitVarArray9); // ticket #6957 TEST_CASE(uninitVarArray9); // ticket #6957, #6959
TEST_CASE(uninitVarArray2D); TEST_CASE(uninitVarArray2D);
TEST_CASE(uninitVarArray3D); TEST_CASE(uninitVarArray3D);
TEST_CASE(uninitVarCpp11Init1); TEST_CASE(uninitVarCpp11Init1);
@ -2414,6 +2414,15 @@ private:
" IxExprListT() {}\n" " IxExprListT() {}\n"
"};"); "};");
ASSERT_EQUALS("[test.cpp:6]: (warning) Member variable 'IxExprListT::eArr' is not initialized in the constructor.\n", errout.str()); 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() { void uninitVarArray2D() {