diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 4a5b9256a..eef7bc00a 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -80,8 +80,8 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti else if (Token::simpleMatch(tok2->next(), "= {") && tok2->linkAt(2)->next()->str() == ";") tok = tok2->linkAt(2)->next(); - else if (Token::Match(tok2->next(), "(|{") && - tok2->next()->link()->next()->str() == ";") + else if (Token::Match(tok2->next(), "(|{") && + tok2->next()->link()->strAt(1) == ";") tok = tok2->next()->link()->next(); else break; // bail diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 14f9f7502..fa102f6aa 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -1844,8 +1844,14 @@ private: } void garbage() { - GET_SYMBOL_DB("void f( { u = 1 ; } ) { }"); - (void)db; + { + GET_SYMBOL_DB("void f( { u = 1 ; } ) { }"); + (void)db; + } + { + GET_SYMBOL_DB("{ }; void namespace A::f; { g() { int } }"); + (void)db; + } } void findFunction1() {