File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1176,9 +1176,18 @@ void SymbolDatabase::createSymbolDatabaseSetFunctionPointers(bool firstPass)
11761176 for (std::list<Scope>::iterator it = scopeList.begin (); it != scopeList.end (); ++it) {
11771177 for (std::list<Function>::const_iterator func = it->functionList .begin (); func != it->functionList .end (); ++func) {
11781178 // look for initializer list
1179- if (func->type == Function::eConstructor && func->functionScope &&
1180- func->functionScope ->functionOf && func->arg && func->arg ->link ()->strAt (1 ) == " :" ) {
1181- const Token * tok = func->arg ->link ()->tokAt (2 );
1179+ if (func->type == Function::eConstructor && func->functionScope && func->functionScope ->functionOf && func->arg ) {
1180+ const Token * tok = func->arg ->link ()->next ();
1181+ if (tok->str () == " noexcept" ) {
1182+ if (!tok->linkAt (1 ) || !tok->linkAt (1 )->next ()) {
1183+ continue ;
1184+ }
1185+ tok = tok->linkAt (1 )->next ();
1186+ }
1187+ if (tok->str () != " :" ) {
1188+ continue ;
1189+ }
1190+ tok = tok->next ();
11821191 while (tok && tok != func->functionScope ->classStart ) {
11831192 if (Token::Match (tok, " %name% {|(" )) {
11841193 if (tok->str () == func->tokenDef ->str ()) {
Original file line number Diff line number Diff line change @@ -1074,6 +1074,18 @@ class TestConstructors : public TestFixture {
10741074 " Foo::Foo() : Foo(0) {}\n "
10751075 " Foo::Foo(int foo) : foo_(foo) {}\n " );
10761076 ASSERT_EQUALS (" " , errout.str ());
1077+
1078+ // Noexcept ctors
1079+ check (" class A {\n "
1080+ " private:\n "
1081+ " int _a;\n "
1082+ " public:\n "
1083+ " A(const int a) noexcept : _a{a} {}\n "
1084+ " A() noexcept;\n "
1085+ " };\n "
1086+ " \n "
1087+ " A::A() noexcept: A(0) {}" );
1088+ ASSERT_EQUALS (" " , errout.str ());
10771089 }
10781090
10791091
You can’t perform that action at this time.
0 commit comments