Standard conversion sequences now have a CopyConstructor field, to
cope with the case where a user-defined conversion is actually a copy
construction, and therefore can be compared against other standard
conversion sequences. While I called this a hack before, now I'm
convinced that it's the right way to go.

Compare overloads based on derived-to-base conversions that invoke
copy constructors. 

Suppress user-defined conversions when attempting to call a
user-defined conversion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58629 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index fa87479..1b08a45 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -370,7 +370,9 @@
   /// C++ Overloading.
   bool IsOverload(FunctionDecl *New, Decl* OldD, 
                   OverloadedFunctionDecl::function_iterator &MatchedDecl);
-  ImplicitConversionSequence TryImplicitConversion(Expr* From, QualType ToType);
+  ImplicitConversionSequence 
+  TryImplicitConversion(Expr* From, QualType ToType,
+                        bool SuppressUserConversions = false);
   bool IsStandardConversion(Expr *From, QualType ToType, 
                             StandardConversionSequence& SCS);
   bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
@@ -398,7 +400,9 @@
   CompareDerivedToBaseConversions(const StandardConversionSequence& SCS1,
                                   const StandardConversionSequence& SCS2);
 
-  ImplicitConversionSequence TryCopyInitialization(Expr* From, QualType ToType);
+  ImplicitConversionSequence 
+  TryCopyInitialization(Expr* From, QualType ToType,
+                        bool SuppressUserConversions = false);
   bool PerformCopyInitialization(Expr *&From, QualType ToType, 
                                  const char *Flavor);
 
@@ -412,10 +416,12 @@
 
   void AddOverloadCandidate(FunctionDecl *Function, 
                             Expr **Args, unsigned NumArgs,
-                            OverloadCandidateSet& CandidateSet);
+                            OverloadCandidateSet& CandidateSet,
+                            bool SuppressUserConversions = false);
   void AddOverloadCandidates(OverloadedFunctionDecl *Ovl, 
                              Expr **Args, unsigned NumArgs,
-                             OverloadCandidateSet& CandidateSet);
+                             OverloadCandidateSet& CandidateSet,
+                             bool SuppressUserConversions = false);
   bool isBetterOverloadCandidate(const OverloadCandidate& Cand1,
                                  const OverloadCandidate& Cand2);
   OverloadingResult BestViableFunction(OverloadCandidateSet& CandidateSet,
@@ -1165,7 +1171,8 @@
                                                       bool& DerivedToBase);
 
   bool CheckReferenceInit(Expr *&simpleInit_or_initList, QualType &declType,
-                          ImplicitConversionSequence *ICS = 0);
+                          ImplicitConversionSequence *ICS = 0,
+                          bool SuppressUserConversions = false);
 
   /// CheckCastTypes - Check type constraints for casting between types.
   bool CheckCastTypes(SourceRange TyRange, QualType CastTy, Expr *&CastExpr);