Fixed #5867 (invalid debug warnung: Scope::checkVariable : varid0)
This commit is contained in:
parent
ad1662a201
commit
e5ae575ace
|
@ -2612,7 +2612,7 @@ bool Scope::isVariableDeclaration(const Token* tok, const Token*& vartok, const
|
|||
typetok = localTypeTok;
|
||||
} else if ((isLocal() || type == Scope::eFunction) &&
|
||||
Token::Match(localVarTok, "%var% (") &&
|
||||
Token::simpleMatch(localVarTok->next()->link(), ") ;")) {
|
||||
Token::simpleMatch(localVarTok->next()->link(), ") ;") && localVarTok->varId()) {
|
||||
vartok = localVarTok;
|
||||
typetok = localTypeTok;
|
||||
} else if (type == eCatch &&
|
||||
|
|
|
@ -245,6 +245,8 @@ private:
|
|||
TEST_CASE(varTypesIntegral); // known integral
|
||||
TEST_CASE(varTypesFloating); // known floating
|
||||
TEST_CASE(varTypesOther); // (un)known
|
||||
|
||||
TEST_CASE(functionPrototype); // ticket #5867
|
||||
}
|
||||
|
||||
void array() const {
|
||||
|
@ -2402,6 +2404,17 @@ private:
|
|||
ASSERT_EQUALS(false, b->isFloatingType());
|
||||
}
|
||||
}
|
||||
|
||||
void functionPrototype() {
|
||||
check("int foo(int x) {\n"
|
||||
" extern int func1();\n"
|
||||
" extern int func2(int);\n"
|
||||
" int func3();\n"
|
||||
" int func4(int);\n"
|
||||
" return func4(x);\n"
|
||||
"}\n", true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestSymbolDatabase)
|
||||
|
|
Loading…
Reference in New Issue