This commit is contained in:
parent
52f549fa87
commit
9582032906
|
@ -5188,9 +5188,13 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst) const
|
|||
vartok = vartok->astOperand1();
|
||||
const Variable* var = vartok->variable();
|
||||
// smart pointer deref?
|
||||
if (var && vartok->astParent() && vartok->astParent()->str() == "*" &&
|
||||
var->isSmartPointer() && var->valueType() && var->valueType()->smartPointerTypeToken)
|
||||
var = var->valueType()->smartPointerTypeToken->variable();
|
||||
bool unknownDeref = false;
|
||||
if (var && vartok->astParent() && vartok->astParent()->str() == "*") {
|
||||
if (var->isSmartPointer() && var->valueType() && var->valueType()->smartPointerTypeToken)
|
||||
var = var->valueType()->smartPointerTypeToken->variable();
|
||||
else
|
||||
unknownDeref = true;
|
||||
}
|
||||
ValueType::MatchResult res = ValueType::matchParameter(arguments[j]->valueType(), var, funcarg);
|
||||
if (res == ValueType::MatchResult::SAME)
|
||||
++same;
|
||||
|
@ -5199,6 +5203,8 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst) const
|
|||
else if (res == ValueType::MatchResult::FALLBACK2)
|
||||
++fallback2;
|
||||
else if (res == ValueType::MatchResult::NOMATCH) {
|
||||
if (unknownDeref)
|
||||
continue;
|
||||
// can't match so remove this function from possible matches
|
||||
matches.erase(matches.begin() + i);
|
||||
erased = true;
|
||||
|
|
|
@ -1726,6 +1726,15 @@ private:
|
|||
" double d;\n"
|
||||
"};", s);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct S {\n" // #8485
|
||||
" explicit S(const T& rhs) { set(*rhs); }\n"
|
||||
" void set(const S& v) {\n"
|
||||
" d = v.d;\n"
|
||||
" }\n"
|
||||
" double d; \n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void operatorEqSTL() {
|
||||
|
|
Loading…
Reference in New Issue