Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2397,7 +2397,7 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
if (!func->hasBody()) {
const Token *closeParen = (*tok)->next()->link();
if (closeParen) {
if (Token::simpleMatch(closeParen, ") = default ;")) {
if (Token::Match(closeParen, ") noexcept| = default ;")) {
func->isDefault(true);
return;
}
Expand Down Expand Up @@ -2469,7 +2469,7 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
// normal function?
const Token *closeParen = (*tok)->next()->link();
if (closeParen) {
if (Token::simpleMatch(closeParen, ") = default ;")) {
if (Token::Match(closeParen, ") noexcept| = default ;")) {
func->isDefault(true);
return;
}
Expand Down
18 changes: 18 additions & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ class TestSymbolDatabase: public TestFixture {
TEST_CASE(symboldatabase80); // #9389
TEST_CASE(symboldatabase81); // #9411
TEST_CASE(symboldatabase82);
TEST_CASE(symboldatabase83); // #9431

TEST_CASE(createSymbolDatabaseFindAllScopes1);

Expand Down Expand Up @@ -4413,6 +4414,23 @@ class TestSymbolDatabase: public TestFixture {
ASSERT_EQUALS(false, db->functionScopes[0]->function->isConstructor());
}

void symboldatabase83() { // #9431
const bool old = settings1.debugwarnings;
settings1.debugwarnings = true;
GET_SYMBOL_DB("struct a { a() noexcept; };\n"
"a::a() noexcept = default;");
settings1.debugwarnings = old;
const Scope *scope = db->findScopeByName("a");
ASSERT(scope);
ASSERT(scope->functionList.size() == 1);
ASSERT(scope->functionList.front().name() == "a");
ASSERT(scope->functionList.front().hasBody() == false);
ASSERT(scope->functionList.front().isConstructor() == true);
ASSERT(scope->functionList.front().isDefault() == true);
ASSERT(scope->functionList.front().isNoExcept() == true);
ASSERT_EQUALS("", errout.str());
}

void createSymbolDatabaseFindAllScopes1() {
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
ASSERT(db->scopeList.size() == 3);
Expand Down