From d212760249e62cd39a9f9076a3bd9f26728c80de Mon Sep 17 00:00:00 2001 From: chrchr Date: Tue, 11 Jul 2023 18:01:11 +0200 Subject: [PATCH] Specific operator --- lib/checkclass.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index a89311da129..c5981cb5321 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -2468,8 +2468,9 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, Member auto hasOverloadedMemberAccess = [](const Token* end, const Scope* scope) -> bool { if (!end || !scope || !Token::simpleMatch(end->astParent(), ".")) return false; - auto it = std::find_if(scope->functionList.begin(), scope->functionList.end(), [](const Function& f) { - return f.isConst() && (f.name() == "operator." || f.name() == "operator->"); + const std::string op = "operator" + end->astParent()->originalName(); + auto it = std::find_if(scope->functionList.begin(), scope->functionList.end(), [&op](const Function& f) { + return f.isConst() && f.name() == op; }); if (it == scope->functionList.end() || !it->retType || !it->retType->classScope) return false;