]> granicus.if.org Git - clang/commitdiff
Pass InOverloadResolution all the way down to IsPointerConversion.
authorAnders Carlsson <andersca@mac.com>
Fri, 28 Aug 2009 15:33:32 +0000 (15:33 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 28 Aug 2009 15:33:32 +0000 (15:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80368 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.h
lib/Sema/SemaCXXCast.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaOverload.cpp

index c59224298abcd201e72a70f61fa108068466b8c4..52eb89e2a05cbb16312ddd253012131524696828 100644 (file)
@@ -727,13 +727,16 @@ public:
   TryImplicitConversion(Expr* From, QualType ToType,
                         bool SuppressUserConversions,
                         bool AllowExplicit,
-                        bool ForceRValue);
-  bool IsStandardConversion(Expr *From, QualType ToType, 
+                        bool ForceRValue,
+                        bool InOverloadResolution);
+  bool IsStandardConversion(Expr *From, QualType ToType,
+                            bool InOverloadResolution,
                             StandardConversionSequence& SCS);
   bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
   bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
   bool IsComplexPromotion(QualType FromType, QualType ToType);
   bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
+                           bool InOverloadResolution,
                            QualType& ConvertedType, bool &IncompatibleObjC);
   bool isObjCPointerConversion(QualType FromType, QualType ToType,
                                QualType& ConvertedType, bool &IncompatibleObjC);
index b528cc421fed11ab8409da8933f3c9f88a016b86..9c27bf6e36ff13e49b8dacd3f287ef0cc9ef24f2 100644 (file)
@@ -785,7 +785,8 @@ TryStaticImplicitCast(Sema &Self, Expr *SrcExpr, QualType DestType,
     Self.TryImplicitConversion(SrcExpr, DestType,
                                /*SuppressUserConversions=*/false,
                                /*AllowExplicit=*/false,
-                               /*ForceRValue=*/false);
+                               /*ForceRValue=*/false,
+                               /*InOverloadResolution=*/false);
   
   if (ICS.ConversionKind  == ImplicitConversionSequence::UserDefinedConversion)
     if (CXXMethodDecl *MD = 
index 5d1c059c7ff1d371e04eaa2731e6f80229b3ae82..31dc8b92c0b5682afa625d8b506fb53fa64a134e 100644 (file)
@@ -3213,7 +3213,8 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
     //   and does not constitute a conversion.
     *ICS = TryImplicitConversion(Init, T1, SuppressUserConversions,
                                  /*AllowExplicit=*/false,
-                                 /*ForceRValue=*/false);
+                                 /*ForceRValue=*/false,
+                                 /*InOverloadResolution=*/false);
     
     // Of course, that's still a reference binding.
     if (ICS->ConversionKind == ImplicitConversionSequence::StandardConversion) {
index 061ac8d2c3333f416638969bee26ed0795fffd47..61891e788339b6d9889b40aa2a57584794f011d9 100644 (file)
@@ -890,13 +890,15 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
     ICS = TryImplicitConversion(From, ToType, 
                                 /*SuppressUserConversions=*/false,
                                 AllowExplicit, 
-                                /*ForceRValue=*/true);
+                                /*ForceRValue=*/true,
+                                /*InOverloadResolution=*/false);
   }
   if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion) {
     ICS = TryImplicitConversion(From, ToType, 
                                 /*SuppressUserConversions=*/false,
                                 AllowExplicit,
-                                /*ForceRValue=*/false);
+                                /*ForceRValue=*/false,
+                                /*InOverloadResolution=*/false);
   }
   return PerformImplicitConversion(From, ToType, ICS, Flavor);
 }
@@ -1259,7 +1261,8 @@ static bool TryClassUnification(Sema &Self, Expr *From, Expr *To,
     ICS = Self.TryImplicitConversion(From, TTy,
                                      /*SuppressUserConversions=*/false,
                                      /*AllowExplicit=*/false,
-                                     /*ForceRValue=*/false);
+                                     /*ForceRValue=*/false,
+                                     /*InOverloadResolution=*/false);
   }
   return false;
 }
@@ -1652,12 +1655,14 @@ QualType Sema::FindCompositePointerType(Expr *&E1, Expr *&E2) {
     TryImplicitConversion(E1, Composite1,
                           /*SuppressUserConversions=*/false,
                           /*AllowExplicit=*/false,
-                          /*ForceRValue=*/false);
+                          /*ForceRValue=*/false,
+                          /*InOverloadResolution=*/false);
   ImplicitConversionSequence E2ToC1 = 
     TryImplicitConversion(E2, Composite1,
                           /*SuppressUserConversions=*/false,
                           /*AllowExplicit=*/false,
-                          /*ForceRValue=*/false);
+                          /*ForceRValue=*/false,
+                          /*InOverloadResolution=*/false);
   
   ImplicitConversionSequence E1ToC2, E2ToC2;
   E1ToC2.ConversionKind = ImplicitConversionSequence::BadConversion;
@@ -1667,11 +1672,13 @@ QualType Sema::FindCompositePointerType(Expr *&E1, Expr *&E2) {
     E1ToC2 = TryImplicitConversion(E1, Composite2,
                                    /*SuppressUserConversions=*/false,
                                    /*AllowExplicit=*/false,
-                                   /*ForceRValue=*/false);
+                                   /*ForceRValue=*/false,
+                                   /*InOverloadResolution=*/false);
     E2ToC2 = TryImplicitConversion(E2, Composite2,
                                    /*SuppressUserConversions=*/false,
                                    /*AllowExplicit=*/false,
-                                   /*ForceRValue=*/false);
+                                   /*ForceRValue=*/false,
+                                   /*InOverloadResolution=*/false);
   }
 
   bool ToC1Viable = E1ToC1.ConversionKind !=
index 7e00a1ecd84586db11c02ccc837cda7340383b89..dffaf41feb1162f942d580d86921e73311c491b9 100644 (file)
@@ -410,10 +410,11 @@ Sema::IsOverload(FunctionDecl *New, Decl* OldD,
 ImplicitConversionSequence
 Sema::TryImplicitConversion(Expr* From, QualType ToType,
                             bool SuppressUserConversions,
-                            bool AllowExplicit, bool ForceRValue)
+                            bool AllowExplicit, bool ForceRValue,
+                            bool InOverloadResolution)
 {
   ImplicitConversionSequence ICS;
-  if (IsStandardConversion(From, ToType, ICS.Standard))
+  if (IsStandardConversion(From, ToType, InOverloadResolution, ICS.Standard))
     ICS.ConversionKind = ImplicitConversionSequence::StandardConversion;
   else if (getLangOptions().CPlusPlus &&
            IsUserDefinedConversion(From, ToType, ICS.UserDefined, 
@@ -471,6 +472,7 @@ Sema::TryImplicitConversion(Expr* From, QualType ToType,
 /// routine will return false and the value of SCS is unspecified.
 bool 
 Sema::IsStandardConversion(Expr* From, QualType ToType, 
+                           bool InOverloadResolution,
                            StandardConversionSequence &SCS)
 {
   QualType FromType = From->getType();
@@ -621,8 +623,8 @@ Sema::IsStandardConversion(Expr* From, QualType ToType,
     // Complex-real conversions (C99 6.3.1.7)
     SCS.Second = ICK_Complex_Real;
     FromType = ToType.getUnqualifiedType();
-  } else if (IsPointerConversion(From, FromType, ToType, FromType, 
-                                 IncompatibleObjC)) {
+  } else if (IsPointerConversion(From, FromType, ToType, InOverloadResolution,
+                                 FromType, IncompatibleObjC)) {
     // Pointer conversions (C++ 4.10).
     SCS.Second = ICK_Pointer_Conversion;
     SCS.IncompatibleObjC = IncompatibleObjC;
@@ -885,6 +887,7 @@ BuildSimilarlyQualifiedPointerType(const PointerType *FromPtr,
 /// set if the conversion is an allowed Objective-C conversion that
 /// should result in a warning.
 bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
+                               bool InOverloadResolution,
                                QualType& ConvertedType,
                                bool &IncompatibleObjC)
 {
@@ -1936,7 +1939,8 @@ Sema::TryCopyInitialization(Expr *From, QualType ToType,
     return TryImplicitConversion(From, ToType, 
                                  SuppressUserConversions,
                                  /*AllowExplicit=*/false,
-                                 ForceRValue);
+                                 ForceRValue,
+                                 InOverloadResolution);
   }
 }
 
@@ -2077,7 +2081,8 @@ ImplicitConversionSequence Sema::TryContextuallyConvertToBool(Expr *From) {
                                // FIXME: Are these flags correct?
                                /*SuppressUserConversions=*/false,
                                /*AllowExplicit=*/true, 
-                               /*ForceRValue=*/false);
+                               /*ForceRValue=*/false,
+                               /*InOverloadResolution=*/false);
 }
 
 /// PerformContextuallyConvertToBool - Perform a contextual conversion
@@ -2291,7 +2296,7 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, Expr *Object,
       Candidate.Conversions[ArgIdx + 1] 
         = TryCopyInitialization(Args[ArgIdx], ParamType, 
                                 SuppressUserConversions, ForceRValue,
-                                /*InOverloadResolution=*/false);
+                                /*InOverloadResolution=*/true);
       if (Candidate.Conversions[ArgIdx + 1].ConversionKind 
             == ImplicitConversionSequence::BadConversion) {
         Candidate.Viable = false;