Fixed #9373 (False Positive - missingOverride)
This commit is contained in:
parent
c3ae028a41
commit
c7a23f126f
|
@ -2121,7 +2121,7 @@ bool Function::argsMatch(const Scope *scope, const Token *first, const Token *se
|
||||||
|
|
||||||
// definition missing variable name
|
// definition missing variable name
|
||||||
else if ((first->next()->str() == "," && second->next()->str() != ",") ||
|
else if ((first->next()->str() == "," && second->next()->str() != ",") ||
|
||||||
(first->next()->str() == ")" && second->next()->str() != ")")) {
|
(Token::Match(first, "!!( )") && second->next()->str() != ")")) {
|
||||||
second = second->next();
|
second = second->next();
|
||||||
// skip default value assignment
|
// skip default value assignment
|
||||||
if (second->next()->str() == "=") {
|
if (second->next()->str() == "=") {
|
||||||
|
@ -2134,7 +2134,7 @@ bool Function::argsMatch(const Scope *scope, const Token *first, const Token *se
|
||||||
|
|
||||||
// function missing variable name
|
// function missing variable name
|
||||||
else if ((second->next()->str() == "," && first->next()->str() != ",") ||
|
else if ((second->next()->str() == "," && first->next()->str() != ",") ||
|
||||||
(second->next()->str() == ")" && first->next()->str() != ")")) {
|
(Token::Match(second, "!!( )") && first->next()->str() != ")")) {
|
||||||
first = first->next();
|
first = first->next();
|
||||||
// skip default value assignment
|
// skip default value assignment
|
||||||
if (first->next()->str() == "=") {
|
if (first->next()->str() == "=") {
|
||||||
|
|
|
@ -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());
|
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() {
|
void overrideCVRefQualifiers() {
|
||||||
|
|
Loading…
Reference in New Issue