Fixed #4391 (False positive: ctor not detected after variable declaration)
This commit is contained in:
parent
327db15284
commit
5a7ede2563
|
@ -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;
|
||||
|
|
|
@ -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("");
|
||||
|
|
Loading…
Reference in New Issue