Fixed #5153 ((debug) Scope::checkVariable found variable ')')

This commit is contained in:
Robert Reif 2013-11-08 12:56:32 +01:00 committed by Daniel Marjamäki
parent a6ef3a224a
commit 52df31b501
2 changed files with 10 additions and 2 deletions

View File

@ -2426,8 +2426,7 @@ bool Scope::isVariableDeclaration(const Token* tok, const Token*& vartok, const
vartok = localVarTok;
typetok = localTypeTok;
} else if (type == eCatch &&
(Token::Match(localTypeTok, "%var% )") ||
Token::Match(localTypeTok, "%var% &| %var% )"))) {
Token::Match(localVarTok, "%var% )")) {
vartok = localVarTok;
typetok = localTypeTok;
}

View File

@ -201,6 +201,7 @@ private:
TEST_CASE(symboldatabase37);
TEST_CASE(symboldatabase38); // ticket #5125 (infinite recursion)
TEST_CASE(symboldatabase39); // ticket #5120 (infinite recursion)
TEST_CASE(symboldatabase40); // ticket #5153
TEST_CASE(isImplicitlyVirtual);
@ -1657,6 +1658,14 @@ private:
check("struct V : { public case {} ; struct U : U void { V *f (int x) (x) } }");
}
void symboldatabase40() { // ticket #5153
check("void f() {\n"
" try { }\n"
" catch (std::bad_alloc) { }\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void isImplicitlyVirtual() {
{
GET_SYMBOL_DB("class Base {\n"