Fixed #4391 (False positive: ctor not detected after variable declaration)

This commit is contained in:
Robert Reif 2012-12-10 06:01:29 +01:00 committed by Daniel Marjamäki
parent 327db15284
commit 5a7ede2563
2 changed files with 12 additions and 0 deletions

View File

@ -57,6 +57,10 @@ void CheckClass::constructors()
for (std::size_t i = 0; i < classes; ++i) {
const Scope * scope = symbolDatabase->classAndStructScopes[i];
// skip forward declarations
if (scope->isForwardDeclaration())
continue;
// don't check uninstantiated template classes
if (scope->classDef->strAt(-1) == ">")
continue;

View File

@ -51,6 +51,7 @@ private:
TEST_CASE(noConstructor4);
TEST_CASE(noConstructor5);
TEST_CASE(noConstructor6); // ticket #4386
TEST_CASE(noConstructor7); // ticket #4391
TEST_CASE(operatorEq1);
TEST_CASE(operatorEq2);
@ -1896,6 +1897,13 @@ private:
ASSERT_EQUALS("", errout.str());
}
void noConstructor7() {
// ticket #4391
checkNoConstructor("short bar;\n"
"class foo;\n");
ASSERT_EQUALS("", errout.str());
}
void checkNoMemset(const char code[]) {
// Clear the error log
errout.str("");