[cfe-commits] r83079 - /cfe/trunk/lib/Sema/SemaOverload.cpp

Fariborz Jahanian fjahanian at apple.com
Tue Sep 29 10:31:54 PDT 2009


Author: fjahanian
Date: Tue Sep 29 12:31:54 2009
New Revision: 83079

URL: http://llvm.org/viewvc/llvm-project?rev=83079&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=83079&r1=83078&r2=83079&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Sep 29 12:31:54 2009
@@ -2241,9 +2241,15 @@
       // 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;





More information about the cfe-commits mailing list