diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 64d7d8575..15877659d 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2712,6 +2712,7 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To const Token *closeParen = (*tok)->next()->link(); if (closeParen) { if (Token::Match(closeParen, ") noexcept| = default ;") || + Token::Match(closeParen, ") . const| %type% &| = default ;") || (Token::simpleMatch(closeParen, ") noexcept (") && Token::simpleMatch(closeParen->linkAt(2), ") = default ;"))) { func->isDefault(true); diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 64ba9ff9c..cdea9a54c 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -322,6 +322,7 @@ private: TEST_CASE(symboldatabase83); // #9431 TEST_CASE(symboldatabase84); TEST_CASE(symboldatabase85); + TEST_CASE(symboldatabase86); TEST_CASE(createSymbolDatabaseFindAllScopes1); @@ -4610,6 +4611,15 @@ private: ASSERT_EQUALS(std::intptr_t(vartok1->variable()), std::intptr_t(vartok2->variable())); } + void symboldatabase86() { + GET_SYMBOL_DB("class C { auto operator=(const C&) -> C&; };\n" + "auto C::operator=(const C&) -> C& = default;"); + ASSERT(db->scopeList.size() == 2); + ASSERT(db->scopeList.back().functionList.size() == 1); + ASSERT(db->scopeList.back().functionList.front().isDefault() == true); + ASSERT(db->scopeList.back().functionList.front().hasBody() == false); + } + void createSymbolDatabaseFindAllScopes1() { GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }"); ASSERT(db->scopeList.size() == 3);