File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
192192 continue ;
193193 else if (Token::Match (tok2, " %name% (" ) && mTokenizer ->isFunctionHead (tok2->next (), " {;" ))
194194 continue ;
195- else if (Token::Match (tok2, " %name% [" ))
195+ else if (Token::Match (tok2, " %name% [|= " ))
196196 continue ;
197197 // skip template
198198 else if (Token::simpleMatch (tok2, " ;" ) &&
Original file line number Diff line number Diff line change @@ -1371,7 +1371,7 @@ void Tokenizer::simplifyTypedef()
13711371 structRemoved = true ;
13721372 typeStart = typeStart->next ();
13731373 }
1374- if (Token::Match (typeStart, " struct|class" ) && Token::Match (tok2, " %name% ::" ))
1374+ if (Token::Match (typeStart, " struct|class|union " ) && Token::Match (tok2, " %name% ::" ))
13751375 typeStart = typeStart->next ();
13761376
13771377 if (sameStartEnd)
Original file line number Diff line number Diff line change @@ -658,7 +658,7 @@ class TestGarbage : public TestFixture {
658658 }
659659
660660 void garbageCode43 () { // #6703
661- ASSERT_THROW ( checkCode (" int { }; struct A<void> a = { }" ), InternalError );
661+ checkCode (" int { }; struct A<void> a = { }" );
662662 }
663663
664664 void garbageCode44 () { // #6704
Original file line number Diff line number Diff line change @@ -356,6 +356,7 @@ class TestSymbolDatabase : public TestFixture {
356356 TEST_CASE (symboldatabase95); // #10295
357357 TEST_CASE (symboldatabase96); // #10126
358358 TEST_CASE (symboldatabase97); // #10598 - final class
359+ TEST_CASE (symboldatabase98); // #10451
359360
360361 TEST_CASE (createSymbolDatabaseFindAllScopes1);
361362 TEST_CASE (createSymbolDatabaseFindAllScopes2);
@@ -4858,6 +4859,26 @@ class TestSymbolDatabase : public TestFixture {
48584859 ASSERT_EQUALS (functok->function ()->type , Function::Type::eConstructor);
48594860 }
48604861
4862+ void symboldatabase98 () { // #10451
4863+ {
4864+ GET_SYMBOL_DB (" struct A { typedef struct {} B; };\n "
4865+ " void f() {\n "
4866+ " auto g = [](A::B b) -> void { A::B b2 = b; };\n "
4867+ " };\n " );
4868+ ASSERT (db);
4869+ ASSERT_EQUALS (5 , db->scopeList .size ());
4870+ }
4871+ {
4872+ GET_SYMBOL_DB (" typedef union {\n "
4873+ " int i;\n "
4874+ " } U;\n "
4875+ " template <auto U::*>\n "
4876+ " void f();\n " );
4877+ ASSERT (db);
4878+ ASSERT_EQUALS (2 , db->scopeList .size ());
4879+ }
4880+ }
4881+
48614882 void createSymbolDatabaseFindAllScopes1 () {
48624883 GET_SYMBOL_DB (" void f() { union {int x; char *p;} a={0}; }" );
48634884 ASSERT (db->scopeList .size () == 3 );
You can’t perform that action at this time.
0 commit comments