From 2fe9883a961dfa872b0a20e8b56e7bf65fc98b6f Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 3 Nov 2008 19:09:14 +0000 Subject: 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. llvm-svn: 58629 --- clang/lib/Sema/SemaDeclCXX.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'clang/lib/Sema/SemaDeclCXX.cpp') diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 703522321a3..1100e700c93 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -931,9 +931,13 @@ Sema::CompareReferenceRelationship(QualType T1, QualType T2, /// errors are found. Either way, a return value of true indicates /// that there was a failure, a return value of false indicates that /// the reference initialization succeeded. +/// +/// When @p SuppressUserConversions, user-defined conversions are +/// suppressed. bool Sema::CheckReferenceInit(Expr *&Init, QualType &DeclType, - ImplicitConversionSequence *ICS) { + ImplicitConversionSequence *ICS, + bool SuppressUserConversions) { assert(DeclType->isReferenceType() && "Reference init needs a reference"); QualType T1 = DeclType->getAsReferenceType()->getPointeeType(); @@ -1114,7 +1118,7 @@ Sema::CheckReferenceInit(Expr *&Init, QualType &DeclType, /// the argument expression. Any difference in top-level /// cv-qualification is subsumed by the initialization itself /// and does not constitute a conversion. - *ICS = TryImplicitConversion(Init, T1); + *ICS = TryImplicitConversion(Init, T1, SuppressUserConversions); return ICS->ConversionKind == ImplicitConversionSequence::BadConversion; } else { return PerformImplicitConversion(Init, T1); -- cgit v1.2.3