diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index f4c34b60d..29cabde35 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2121,7 +2121,7 @@ bool Function::argsMatch(const Scope *scope, const Token *first, const Token *se // definition missing variable name else if ((first->next()->str() == "," && second->next()->str() != ",") || - (first->next()->str() == ")" && second->next()->str() != ")")) { + (Token::Match(first, "!!( )") && second->next()->str() != ")")) { second = second->next(); // skip default value assignment if (second->next()->str() == "=") { @@ -2134,7 +2134,7 @@ bool Function::argsMatch(const Scope *scope, const Token *first, const Token *se // function missing variable name else if ((second->next()->str() == "," && first->next()->str() != ",") || - (second->next()->str() == ")" && first->next()->str() != ")")) { + (Token::Match(second, "!!( )") && first->next()->str() != ")")) { first = first->next(); // skip default value assignment if (first->next()->str() == "=") { diff --git a/test/testclass.cpp b/test/testclass.cpp index 794f9b2c2..250871e04 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -7152,6 +7152,15 @@ private: "};"); ASSERT_EQUALS("[test.cpp:4] -> [test.cpp:9]: (style) The destructor '~C' overrides a destructor in a base class but is not marked with a 'override' specifier.\n", errout.str()); + checkOverride("struct Base {\n" + " virtual void foo();\n" + "};\n" + "\n" + "struct Derived: public Base {\n" + " void foo() override;\n" + " void foo(int);\n" + "};"); + ASSERT_EQUALS("", errout.str()); } void overrideCVRefQualifiers() {