Fix #10451 syntaxError with typedef and lambda
This commit is contained in:
parent
0d336b868c
commit
fdc7577c32
|
@ -192,7 +192,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
|
|||
continue;
|
||||
else if (Token::Match(tok2, "%name% (") && mTokenizer->isFunctionHead(tok2->next(), "{;"))
|
||||
continue;
|
||||
else if (Token::Match(tok2, "%name% ["))
|
||||
else if (Token::Match(tok2, "%name% [|="))
|
||||
continue;
|
||||
// skip template
|
||||
else if (Token::simpleMatch(tok2, ";") &&
|
||||
|
|
|
@ -658,7 +658,7 @@ private:
|
|||
}
|
||||
|
||||
void garbageCode43() { // #6703
|
||||
ASSERT_THROW(checkCode("int { }; struct A<void> a = { }"), InternalError);
|
||||
checkCode("int { }; struct A<void> a = { }");
|
||||
}
|
||||
|
||||
void garbageCode44() { // #6704
|
||||
|
|
|
@ -356,6 +356,7 @@ private:
|
|||
TEST_CASE(symboldatabase95); // #10295
|
||||
TEST_CASE(symboldatabase96); // #10126
|
||||
TEST_CASE(symboldatabase97); // #10598 - final class
|
||||
TEST_CASE(symboldatabase98); // #10451
|
||||
|
||||
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
||||
TEST_CASE(createSymbolDatabaseFindAllScopes2);
|
||||
|
@ -4858,6 +4859,20 @@ private:
|
|||
ASSERT_EQUALS(functok->function()->type, Function::Type::eConstructor);
|
||||
}
|
||||
|
||||
void symboldatabase98() { // #10451
|
||||
GET_SYMBOL_DB("struct A { typedef struct {} B; };\n"
|
||||
"void f() {\n"
|
||||
" auto g = [](A::B b) -> void { A::B b2 = b; };\n" }
|
||||
"};\n");
|
||||
ASSERT(db);
|
||||
ASSERT_EQUALS(3, db->scopeList.size());
|
||||
|
||||
const Token *functok = Token::findmatch(tokenizer.tokens(), "%name% (");
|
||||
ASSERT(functok);
|
||||
ASSERT(functok->function());
|
||||
ASSERT_EQUALS(functok->function()->type, Function::Type::eConstructor);
|
||||
}
|
||||
|
||||
void createSymbolDatabaseFindAllScopes1() {
|
||||
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
||||
ASSERT(db->scopeList.size() == 3);
|
||||
|
|
Loading…
Reference in New Issue