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();
|
vartok = vartok->astOperand1();
|
||||||
const Variable* var = vartok->variable();
|
const Variable* var = vartok->variable();
|
||||||
// smart pointer deref?
|
// smart pointer deref?
|
||||||
if (var && vartok->astParent() && vartok->astParent()->str() == "*" &&
|
bool unknownDeref = false;
|
||||||
var->isSmartPointer() && var->valueType() && var->valueType()->smartPointerTypeToken)
|
if (var && vartok->astParent() && vartok->astParent()->str() == "*") {
|
||||||
var = var->valueType()->smartPointerTypeToken->variable();
|
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);
|
ValueType::MatchResult res = ValueType::matchParameter(arguments[j]->valueType(), var, funcarg);
|
||||||
if (res == ValueType::MatchResult::SAME)
|
if (res == ValueType::MatchResult::SAME)
|
||||||
++same;
|
++same;
|
||||||
|
@ -5199,6 +5203,8 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst) const
|
||||||
else if (res == ValueType::MatchResult::FALLBACK2)
|
else if (res == ValueType::MatchResult::FALLBACK2)
|
||||||
++fallback2;
|
++fallback2;
|
||||||
else if (res == ValueType::MatchResult::NOMATCH) {
|
else if (res == ValueType::MatchResult::NOMATCH) {
|
||||||
|
if (unknownDeref)
|
||||||
|
continue;
|
||||||
// can't match so remove this function from possible matches
|
// can't match so remove this function from possible matches
|
||||||
matches.erase(matches.begin() + i);
|
matches.erase(matches.begin() + i);
|
||||||
erased = true;
|
erased = true;
|
||||||
|
|
|
@ -1726,6 +1726,15 @@ private:
|
||||||
" double d;\n"
|
" double d;\n"
|
||||||
"};", s);
|
"};", s);
|
||||||
ASSERT_EQUALS("", errout.str());
|
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() {
|
void operatorEqSTL() {
|
||||||
|
|
Loading…
Reference in New Issue