forked from qt-creator/qt-creator
CPlusPlus: Fix overload resolution involving default arguments
If one of the overloads had additional default arguments, then for each of these, its priority was increased, which does not appear to make any sense. Fixes: QTCREATORBUG-17807 Change-Id: Id5be81ce52c615a424fe4314d2e50385b3fb2b1c Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -849,22 +849,14 @@ bool ResolveExpression::visit(CallAST *ast)
|
||||
int score = 0;
|
||||
|
||||
for (unsigned i = 0, argc = funTy->argumentCount(); i < argc; ++i) {
|
||||
if (i >= unsigned(arguments.size()))
|
||||
break;
|
||||
|
||||
const FullySpecifiedType formalTy = funTy->argumentAt(i)->type();
|
||||
|
||||
FullySpecifiedType actualTy;
|
||||
if (i < unsigned(arguments.size())) {
|
||||
const QList<LookupItem> actual = arguments.at(i);
|
||||
if (actual.isEmpty())
|
||||
continue;
|
||||
|
||||
actualTy = actual.first().type();
|
||||
} else {
|
||||
actualTy = formalTy;
|
||||
score += 2;
|
||||
const QList<LookupItem> actual = arguments.at(i);
|
||||
if (actual.isEmpty())
|
||||
continue;
|
||||
}
|
||||
|
||||
score += evaluateFunctionArgument(actualTy, formalTy);
|
||||
score += evaluateFunctionArgument(actual.first().type(), formalTy);
|
||||
}
|
||||
|
||||
sortedResults.insert(LookupMap::value_type(-score, base));
|
||||
|
||||
Reference in New Issue
Block a user