This commit is contained in:
Alexander Mai 2015-05-24 09:43:52 +02:00
commit 7002f9df35
2 changed files with 6 additions and 1 deletions

View File

@ -2792,7 +2792,7 @@ void Tokenizer::setVarId()
const Token* tokStart = tok->tokAt(2); const Token* tokStart = tok->tokAt(2);
while (tokStart && tokStart->str() != "{") { while (tokStart && tokStart->str() != "{") {
if (Token::Match(tokStart, "public|private|protected")) if (Token::Match(tokStart, "public|private|protected %name%"))
tokStart = tokStart->next(); tokStart = tokStart->next();
if (tokStart->strAt(1) == "," || tokStart->strAt(1) == "{") if (tokStart->strAt(1) == "," || tokStart->strAt(1) == "{")
varlist[classname].insert(varlist[tokStart->str()].begin(), varlist[tokStart->str()].end()); varlist[classname].insert(varlist[tokStart->str()].begin(), varlist[tokStart->str()].end());

View File

@ -82,6 +82,7 @@ private:
TEST_CASE(garbageCode41); // #6685 TEST_CASE(garbageCode41); // #6685
TEST_CASE(garbageCode42); // #5760 TEST_CASE(garbageCode42); // #5760
TEST_CASE(garbageCode43); // #6703 TEST_CASE(garbageCode43); // #6703
TEST_CASE(garbageCode44); // #6704
TEST_CASE(garbageValueFlow); TEST_CASE(garbageValueFlow);
TEST_CASE(garbageSymbolDatabase); TEST_CASE(garbageSymbolDatabase);
@ -475,6 +476,10 @@ private:
checkCode("int { }; struct A<void> a = { }"); checkCode("int { }; struct A<void> a = { }");
} }
void garbageCode44() { // #6704
ASSERT_THROW(checkCode("{ { }; }; { class A : }; public typedef b;"), InternalError);
}
void garbageValueFlow() { void garbageValueFlow() {
// #6089 // #6089
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n" const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"