Merge pull request #662 from simartin/ticket_6959

Ticket #6959: Properly handle arrays of pointers in CheckClass::constructors
This commit is contained in:
Daniel Marjamäki 2015-08-29 13:22:10 +02:00
commit e31ee26b6c
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
if (!var->isPointer() && var->typeScope()) {
if (!var->isPointer() && !var->isPointerArray() && var->typeScope()) {
if (func->type == Function::eMoveConstructor) {
if (canNotMove(var->typeScope()))
continue;

View File

@ -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() {