Fixed #4404 (Forward declared class cause false style warning about missing constructor)

This commit is contained in:
Robert Reif 2012-12-16 07:18:03 +01:00 committed by Daniel Marjamäki
parent fa8e5cd7d8
commit 6732f05b95
2 changed files with 16 additions and 1 deletions

View File

@ -1912,9 +1912,15 @@ void Scope::getVariableList()
if (classStart)
start = classStart->next();
else
// global scope
else if (className.empty())
start = check->_tokenizer->tokens();
// forward declaration
else
return;
for (const Token *tok = start; tok; tok = tok->next()) {
// end of scope?
if (tok->str() == "}") {

View File

@ -52,6 +52,7 @@ private:
TEST_CASE(noConstructor5);
TEST_CASE(noConstructor6); // ticket #4386
TEST_CASE(noConstructor7); // ticket #4391
TEST_CASE(noConstructor8); // ticket #4404
TEST_CASE(operatorEq1);
TEST_CASE(operatorEq2);
@ -1904,6 +1905,14 @@ private:
ASSERT_EQUALS("", errout.str());
}
void noConstructor8() {
// ticket #4404
checkNoConstructor("class LineSegment;\n"
"class PointArray { };\n"
"void* tech_ = NULL;\n");
ASSERT_EQUALS("", errout.str());
}
void checkNoMemset(const char code[]) {
// Clear the error log
errout.str("");