diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index fb04d65fb..95bab3947 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1787,9 +1787,8 @@ Function::Function(const Tokenizer *_tokenizer, const Token *tok, const Scope *s setFlag(fHasFinalSpecifier, true); else if (tok->str() == "noexcept") { isNoExcept(!Token::simpleMatch(tok->next(), "( false )")); - tok = tok->next(); - if (tok->str() == "(") - tok = tok->link(); + if (tok->next()->str() == "(") + tok = tok->linkAt(1); } else if (Token::simpleMatch(tok, "throw (")) { isThrow(true); if (tok->strAt(2) != ")") diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 22002a989..4512a658a 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -284,6 +284,7 @@ private: TEST_CASE(symboldatabase64); TEST_CASE(symboldatabase65); TEST_CASE(symboldatabase66); // #8540 + TEST_CASE(symboldatabase67); // #8538 TEST_CASE(enum1); TEST_CASE(enum2); @@ -2858,6 +2859,7 @@ private: if (db) { ASSERT_EQUALS(1U, db->functionScopes.size()); ASSERT_EQUALS("getReg", db->functionScopes.front()->className); + ASSERT_EQUALS(true, db->functionScopes.front()->function->hasOverrideSpecifier()); } } @@ -3827,6 +3829,15 @@ private: ASSERT(db && db->typeList.size() == 3); } + void symboldatabase67() { // #8538 + GET_SYMBOL_DB("std::string get_endpoint_url() const noexcept override;"); + const Function *f = db ? &db->scopeList.front().functionList.front() : nullptr; + ASSERT(f != nullptr); + ASSERT(f && f->hasOverrideSpecifier()); + ASSERT(f && f->isConst()); + ASSERT(f && f->isNoExcept()); + } + void enum1() { GET_SYMBOL_DB("enum BOOL { FALSE, TRUE }; enum BOOL b;");