parent
8fb794e731
commit
6b4a3bc830
|
@ -2397,7 +2397,7 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
|
||||||
if (!func->hasBody()) {
|
if (!func->hasBody()) {
|
||||||
const Token *closeParen = (*tok)->next()->link();
|
const Token *closeParen = (*tok)->next()->link();
|
||||||
if (closeParen) {
|
if (closeParen) {
|
||||||
if (Token::simpleMatch(closeParen, ") = default ;")) {
|
if (Token::Match(closeParen, ") noexcept| = default ;")) {
|
||||||
func->isDefault(true);
|
func->isDefault(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2469,7 +2469,7 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
|
||||||
// normal function?
|
// normal function?
|
||||||
const Token *closeParen = (*tok)->next()->link();
|
const Token *closeParen = (*tok)->next()->link();
|
||||||
if (closeParen) {
|
if (closeParen) {
|
||||||
if (Token::simpleMatch(closeParen, ") = default ;")) {
|
if (Token::Match(closeParen, ") noexcept| = default ;")) {
|
||||||
func->isDefault(true);
|
func->isDefault(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,6 +307,7 @@ private:
|
||||||
TEST_CASE(symboldatabase80); // #9389
|
TEST_CASE(symboldatabase80); // #9389
|
||||||
TEST_CASE(symboldatabase81); // #9411
|
TEST_CASE(symboldatabase81); // #9411
|
||||||
TEST_CASE(symboldatabase82);
|
TEST_CASE(symboldatabase82);
|
||||||
|
TEST_CASE(symboldatabase83); // #9431
|
||||||
|
|
||||||
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
||||||
|
|
||||||
|
@ -4423,6 +4424,23 @@ private:
|
||||||
ASSERT_EQUALS(false, db->functionScopes[0]->function->isConstructor());
|
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() {
|
void createSymbolDatabaseFindAllScopes1() {
|
||||||
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
||||||
ASSERT(db->scopeList.size() == 3);
|
ASSERT(db->scopeList.size() == 3);
|
||||||
|
|
Loading…
Reference in New Issue