diff options
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 1283ff4b5e..9e76617722 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -2241,9 +2241,15 @@ Sema::AddOverloadCandidate(FunctionDecl *Function, // ranking implicit conversion sequences as described in 13.3.3.2, the ambiguous // conversion sequence is treated as a user-defined sequence that is // indistinguishable from any other user-defined conversion sequence - if (!Candidate.Conversions[ArgIdx].ConversionFunctionSet.empty()) + if (!Candidate.Conversions[ArgIdx].ConversionFunctionSet.empty()) { Candidate.Conversions[ArgIdx].ConversionKind = ImplicitConversionSequence::UserDefinedConversion; + // Set the conversion function to one of them. As due to ambiguity, + // they carry the same weight and is needed for overload resolution + // later. + Candidate.Conversions[ArgIdx].UserDefined.ConversionFunction = + Candidate.Conversions[ArgIdx].ConversionFunctionSet[0]; + } else { Candidate.Viable = false; break; |