@@ -5586,7 +5586,7 @@ bool Scope::hasInlineOrLambdaFunction(const Token** tokStart, bool onlyInline) c
55865586 });
55875587}
55885588
5589- void Scope::findFunctionInBase (const std::string & name , nonneg int args, std::vector<const Function *> & matches) const
5589+ void Scope::findFunctionInBase (const Token* tok , nonneg int args, std::vector<const Function *> & matches) const
55905590{
55915591 if (isClassOrStruct () && definedType && !definedType->derivedFrom .empty ()) {
55925592 const std::vector<Type::BaseInfo> &derivedFrom = definedType->derivedFrom ;
@@ -5596,16 +5596,18 @@ void Scope::findFunctionInBase(const std::string & name, nonneg int args, std::v
55965596 if (base->classScope == this ) // Ticket #5120, #5125: Recursive class; tok should have been found already
55975597 continue ;
55985598
5599- auto range = utils::as_const (base->classScope ->functionMap ).equal_range (name );
5599+ auto range = utils::as_const (base->classScope ->functionMap ).equal_range (tok-> str () );
56005600 for (auto it = range.first ; it != range.second ; ++it) {
56015601 const Function *func = it->second ;
5602+ if (func->isDestructor () && !Token::simpleMatch (tok->tokAt (-1 ), " ~" ))
5603+ continue ;
56025604 if ((func->isVariadic () && args >= (func->argCount () - 1 )) ||
56035605 (args == func->argCount () || (args < func->argCount () && args >= func->minArgCount ()))) {
56045606 matches.push_back (func);
56055607 }
56065608 }
56075609
5608- base->classScope ->findFunctionInBase (name , args, matches);
5610+ base->classScope ->findFunctionInBase (tok , args, matches);
56095611 }
56105612 }
56115613 }
@@ -5791,7 +5793,7 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst, Referen
57915793 const std::size_t numberOfMatchesNonBase = matches.size ();
57925794
57935795 // check in base classes
5794- findFunctionInBase (tok-> str () , args, matches);
5796+ findFunctionInBase (tok, args, matches);
57955797
57965798 // Non-call => Do not match parameters
57975799 if (!isCall) {
0 commit comments