Skip to content

Commit 8976e96

Browse files
Update checkclass.cpp
1 parent f0dfef6 commit 8976e96

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/checkclass.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,11 @@ void CheckClass::checkConst()
21922192
if (suggestStatic && func.isConst()) {
21932193
const auto overloads = func.getOverloadedFunctions();
21942194
if (overloads.size() > 1 && std::any_of(overloads.begin(), overloads.end(), [&](const Function* ovl) {
2195-
return &func != ovl && func.argCount() == ovl->argCount() && func.argsMatch(ovl->functionScope, ovl->argDef, func.argDef, emptyString, 0);
2195+
if (&func == ovl)
2196+
return false;
2197+
if (!ovl->functionScope)
2198+
return true;
2199+
return func.argCount() == ovl->argCount() && func.argsMatch(ovl->functionScope, ovl->argDef, func.argDef, emptyString, 0);
21962200
}))
21972201
continue;
21982202
}

0 commit comments

Comments
 (0)