]> granicus.if.org Git - clang/commitdiff
Fixes a nasty bug which only turned up in 32bit build of clang and
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 29 Sep 2009 17:31:54 +0000 (17:31 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 29 Sep 2009 17:31:54 +0000 (17:31 +0000)
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

lib/Sema/SemaOverload.cpp

index 1283ff4b5ebd2095c0aa669911bd4d898cfafbd9..9e7661772280424f948c448ec6a647a4959b01fb 100644 (file)
@@ -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;