diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 21df3f8cc63..bdafc33e88e 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -738,7 +738,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes() tok = tok->link(); } } else if (Token::Match(tok, "%name% (")) { - if (tok->next() && Token::simpleMatch(tok->next()->link(), ") ;")) { + if (Token::simpleMatch(tok->linkAt(1), ") ;")) { const Token *funcStart = nullptr; const Token *argStart = nullptr; const Token *declEnd = nullptr; diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 3310101dd98..533d44b5120 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -2309,7 +2309,10 @@ class TestSymbolDatabase : public TestFixture { ASSERT(db && errout.str().empty()); const Token *f = Token::findsimplematch(tokenizer.tokens(), "bar"); - ASSERT(f && f->function() && f->function()->isExtern() && f->function()->retDef->str() == "void"); + ASSERT(f && f->function() && f->function()->isExtern() && f == f->function()->tokenDef && f->function()->retDef->str() == "void"); + + const Token *call = Token::findsimplematch(f->next(), "bar"); + ASSERT(call && call->function() && call->function()->isExtern() && call->function() == f->function()); } void classWithFriend() {