Fixed #4404 (Forward declared class cause false style warning about missing constructor)
This commit is contained in:
parent
fa8e5cd7d8
commit
6732f05b95
|
@ -1912,9 +1912,15 @@ void Scope::getVariableList()
|
||||||
|
|
||||||
if (classStart)
|
if (classStart)
|
||||||
start = classStart->next();
|
start = classStart->next();
|
||||||
else
|
|
||||||
|
// global scope
|
||||||
|
else if (className.empty())
|
||||||
start = check->_tokenizer->tokens();
|
start = check->_tokenizer->tokens();
|
||||||
|
|
||||||
|
// forward declaration
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
for (const Token *tok = start; tok; tok = tok->next()) {
|
for (const Token *tok = start; tok; tok = tok->next()) {
|
||||||
// end of scope?
|
// end of scope?
|
||||||
if (tok->str() == "}") {
|
if (tok->str() == "}") {
|
||||||
|
|
|
@ -52,6 +52,7 @@ private:
|
||||||
TEST_CASE(noConstructor5);
|
TEST_CASE(noConstructor5);
|
||||||
TEST_CASE(noConstructor6); // ticket #4386
|
TEST_CASE(noConstructor6); // ticket #4386
|
||||||
TEST_CASE(noConstructor7); // ticket #4391
|
TEST_CASE(noConstructor7); // ticket #4391
|
||||||
|
TEST_CASE(noConstructor8); // ticket #4404
|
||||||
|
|
||||||
TEST_CASE(operatorEq1);
|
TEST_CASE(operatorEq1);
|
||||||
TEST_CASE(operatorEq2);
|
TEST_CASE(operatorEq2);
|
||||||
|
@ -1904,6 +1905,14 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
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[]) {
|
void checkNoMemset(const char code[]) {
|
||||||
// Clear the error log
|
// Clear the error log
|
||||||
errout.str("");
|
errout.str("");
|
||||||
|
|
Loading…
Reference in New Issue