* Fix #10451 syntaxError with typedef and lambda
* Don't insert union into template argument list, add test
* Format
* Revert "Format"
This reverts commit 8c52d49c8b
.
* Format
This commit is contained in:
parent
d3d40fd599
commit
6376bac5bb
|
@ -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, ";") &&
|
||||
|
|
|
@ -1371,7 +1371,7 @@ void Tokenizer::simplifyTypedef()
|
|||
structRemoved = true;
|
||||
typeStart = typeStart->next();
|
||||
}
|
||||
if (Token::Match(typeStart, "struct|class") && Token::Match(tok2, "%name% ::"))
|
||||
if (Token::Match(typeStart, "struct|class|union") && Token::Match(tok2, "%name% ::"))
|
||||
typeStart = typeStart->next();
|
||||
|
||||
if (sameStartEnd)
|
||||
|
|
|
@ -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,26 @@ 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(5, db->scopeList.size());
|
||||
}
|
||||
{
|
||||
GET_SYMBOL_DB("typedef union {\n"
|
||||
" int i;\n"
|
||||
"} U;\n"
|
||||
"template <auto U::*>\n"
|
||||
"void f();\n");
|
||||
ASSERT(db);
|
||||
ASSERT_EQUALS(2, db->scopeList.size());
|
||||
}
|
||||
}
|
||||
|
||||
void createSymbolDatabaseFindAllScopes1() {
|
||||
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
||||
ASSERT(db->scopeList.size() == 3);
|
||||
|
|
Loading…
Reference in New Issue