diff options
-rw-r--r-- | lib/Sema/Sema.h | 3 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaInit.cpp | 5 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 12 |
4 files changed, 17 insertions, 7 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index a5a0723256..2ed90d0164 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -766,8 +766,7 @@ public: ImplicitConversionSequence TryCopyInitialization(Expr* From, QualType ToType, - bool SuppressUserConversions = false, - bool ForceRValue = false); + bool SuppressUserConversions, bool ForceRValue); bool PerformCopyInitialization(Expr *&From, QualType ToType, const char *Flavor, bool Elidable = false); diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 85924948da..870041dc87 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1228,7 +1228,9 @@ static bool TryClassUnification(Sema &Self, Expr *From, Expr *To, // Could still fail if there's no copy constructor. // FIXME: Is this a hard error then, or just a conversion failure? The // standard doesn't say. - ICS = Self.TryCopyInitialization(From, TTy); + ICS = Self.TryCopyInitialization(From, TTy, + /*SuppressUserConversions=*/false, + /*ForceRValue=*/false); } } else { // -- Otherwise: E1 can be converted to match E2 if E1 can be diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 405dd8489e..fb00008983 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -661,7 +661,10 @@ void InitListChecker::CheckSubElementType(InitListExpr *IList, // an initializer-list. If the initializer can initialize a // member, the member is initialized. [...] ImplicitConversionSequence ICS - = SemaRef.TryCopyInitialization(expr, ElemType); + = SemaRef.TryCopyInitialization(expr, ElemType, + /*SuppressUserConversions=*/false, + /*ForceRValue=*/false); + if (ICS.ConversionKind != ImplicitConversionSequence::BadConversion) { if (SemaRef.PerformImplicitConversion(expr, ElemType, ICS, "initializing")) diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index dde5c28723..52010ab514 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -2430,7 +2430,11 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion, CallExpr Call(Context, &ConversionFn, 0, 0, Conversion->getConversionType().getNonReferenceType(), SourceLocation()); - ImplicitConversionSequence ICS = TryCopyInitialization(&Call, ToType, true); + ImplicitConversionSequence ICS = + TryCopyInitialization(&Call, ToType, + /*SuppressUserConversions=*/true, + /*ForceRValue=*/false); + switch (ICS.ConversionKind) { case ImplicitConversionSequence::StandardConversion: Candidate.FinalConversion = ICS.Standard; @@ -2543,7 +2547,8 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, QualType ParamType = Proto->getArgType(ArgIdx); Candidate.Conversions[ArgIdx + 1] = TryCopyInitialization(Args[ArgIdx], ParamType, - /*SuppressUserConversions=*/false); + /*SuppressUserConversions=*/false, + /*ForceRValue=*/false); if (Candidate.Conversions[ArgIdx + 1].ConversionKind == ImplicitConversionSequence::BadConversion) { Candidate.Viable = false; @@ -2674,7 +2679,8 @@ void Sema::AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys, } else { Candidate.Conversions[ArgIdx] = TryCopyInitialization(Args[ArgIdx], ParamTys[ArgIdx], - ArgIdx == 0 && IsAssignmentOperator); + ArgIdx == 0 && IsAssignmentOperator, + /*ForceRValue=*/false); } if (Candidate.Conversions[ArgIdx].ConversionKind == ImplicitConversionSequence::BadConversion) { |