From: Fariborz Jahanian Date: Tue, 29 Sep 2009 17:31:54 +0000 (+0000) Subject: Fixes a nasty bug which only turned up in 32bit build of clang and X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a6a2b80c1771a2688a6349f8302263a3ebf4659;p=clang Fixes a nasty bug which only turned up in 32bit build of clang and had to do with an initialized field when multiple type conversions are ambiguous but must be treated as user defined conversion for overload resolution purposes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83079 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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;