Add an InOverloadResolution flag to TryCopyInitialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80261 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anders Carlsson 2009-08-27 17:37:39 +00:00
Родитель 2de3aced4c
Коммит 7b361b5880
4 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -766,7 +766,8 @@ public:
ImplicitConversionSequence ImplicitConversionSequence
TryCopyInitialization(Expr* From, QualType ToType, TryCopyInitialization(Expr* From, QualType ToType,
bool SuppressUserConversions, bool ForceRValue); bool SuppressUserConversions, bool ForceRValue,
bool InOverloadResolution);
bool PerformCopyInitialization(Expr *&From, QualType ToType, bool PerformCopyInitialization(Expr *&From, QualType ToType,
const char *Flavor, bool Elidable = false); const char *Flavor, bool Elidable = false);

Просмотреть файл

@ -1238,7 +1238,8 @@ static bool TryClassUnification(Sema &Self, Expr *From, Expr *To,
// standard doesn't say. // standard doesn't say.
ICS = Self.TryCopyInitialization(From, TTy, ICS = Self.TryCopyInitialization(From, TTy,
/*SuppressUserConversions=*/false, /*SuppressUserConversions=*/false,
/*ForceRValue=*/false); /*ForceRValue=*/false,
/*InOverloadResolution=*/false);
} }
} else { } else {
// -- Otherwise: E1 can be converted to match E2 if E1 can be // -- Otherwise: E1 can be converted to match E2 if E1 can be

Просмотреть файл

@ -666,7 +666,8 @@ void InitListChecker::CheckSubElementType(InitListExpr *IList,
ImplicitConversionSequence ICS ImplicitConversionSequence ICS
= SemaRef.TryCopyInitialization(expr, ElemType, = SemaRef.TryCopyInitialization(expr, ElemType,
/*SuppressUserConversions=*/false, /*SuppressUserConversions=*/false,
/*ForceRValue=*/false); /*ForceRValue=*/false,
/*InOverloadResolution=*/false);
if (ICS.ConversionKind != ImplicitConversionSequence::BadConversion) { if (ICS.ConversionKind != ImplicitConversionSequence::BadConversion) {
if (SemaRef.PerformImplicitConversion(expr, ElemType, ICS, if (SemaRef.PerformImplicitConversion(expr, ElemType, ICS,

Просмотреть файл

@ -1922,7 +1922,8 @@ Sema::CompareDerivedToBaseConversions(const StandardConversionSequence& SCS1,
/// then we treat @p From as an rvalue, even if it is an lvalue. /// then we treat @p From as an rvalue, even if it is an lvalue.
ImplicitConversionSequence ImplicitConversionSequence
Sema::TryCopyInitialization(Expr *From, QualType ToType, Sema::TryCopyInitialization(Expr *From, QualType ToType,
bool SuppressUserConversions, bool ForceRValue) { bool SuppressUserConversions, bool ForceRValue,
bool InOverloadResolution) {
if (ToType->isReferenceType()) { if (ToType->isReferenceType()) {
ImplicitConversionSequence ICS; ImplicitConversionSequence ICS;
CheckReferenceInit(From, ToType, CheckReferenceInit(From, ToType,
@ -2172,7 +2173,8 @@ Sema::AddOverloadCandidate(FunctionDecl *Function,
QualType ParamType = Proto->getArgType(ArgIdx); QualType ParamType = Proto->getArgType(ArgIdx);
Candidate.Conversions[ArgIdx] Candidate.Conversions[ArgIdx]
= TryCopyInitialization(Args[ArgIdx], ParamType, = TryCopyInitialization(Args[ArgIdx], ParamType,
SuppressUserConversions, ForceRValue); SuppressUserConversions, ForceRValue,
/*InOverloadResolution=*/true);
if (Candidate.Conversions[ArgIdx].ConversionKind if (Candidate.Conversions[ArgIdx].ConversionKind
== ImplicitConversionSequence::BadConversion) { == ImplicitConversionSequence::BadConversion) {
Candidate.Viable = false; Candidate.Viable = false;
@ -2288,7 +2290,8 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, Expr *Object,
QualType ParamType = Proto->getArgType(ArgIdx); QualType ParamType = Proto->getArgType(ArgIdx);
Candidate.Conversions[ArgIdx + 1] Candidate.Conversions[ArgIdx + 1]
= TryCopyInitialization(Args[ArgIdx], ParamType, = TryCopyInitialization(Args[ArgIdx], ParamType,
SuppressUserConversions, ForceRValue); SuppressUserConversions, ForceRValue,
/*InOverloadResolution=*/false);
if (Candidate.Conversions[ArgIdx + 1].ConversionKind if (Candidate.Conversions[ArgIdx + 1].ConversionKind
== ImplicitConversionSequence::BadConversion) { == ImplicitConversionSequence::BadConversion) {
Candidate.Viable = false; Candidate.Viable = false;
@ -2445,7 +2448,8 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion,
ImplicitConversionSequence ICS = ImplicitConversionSequence ICS =
TryCopyInitialization(&Call, ToType, TryCopyInitialization(&Call, ToType,
/*SuppressUserConversions=*/true, /*SuppressUserConversions=*/true,
/*ForceRValue=*/false); /*ForceRValue=*/false,
/*InOverloadResolution=*/false);
switch (ICS.ConversionKind) { switch (ICS.ConversionKind) {
case ImplicitConversionSequence::StandardConversion: case ImplicitConversionSequence::StandardConversion:
@ -2560,7 +2564,8 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion,
Candidate.Conversions[ArgIdx + 1] Candidate.Conversions[ArgIdx + 1]
= TryCopyInitialization(Args[ArgIdx], ParamType, = TryCopyInitialization(Args[ArgIdx], ParamType,
/*SuppressUserConversions=*/false, /*SuppressUserConversions=*/false,
/*ForceRValue=*/false); /*ForceRValue=*/false,
/*InOverloadResolution=*/false);
if (Candidate.Conversions[ArgIdx + 1].ConversionKind if (Candidate.Conversions[ArgIdx + 1].ConversionKind
== ImplicitConversionSequence::BadConversion) { == ImplicitConversionSequence::BadConversion) {
Candidate.Viable = false; Candidate.Viable = false;
@ -2692,7 +2697,8 @@ void Sema::AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys,
Candidate.Conversions[ArgIdx] Candidate.Conversions[ArgIdx]
= TryCopyInitialization(Args[ArgIdx], ParamTys[ArgIdx], = TryCopyInitialization(Args[ArgIdx], ParamTys[ArgIdx],
ArgIdx == 0 && IsAssignmentOperator, ArgIdx == 0 && IsAssignmentOperator,
/*ForceRValue=*/false); /*ForceRValue=*/false,
/*InOverloadResolution=*/false);
} }
if (Candidate.Conversions[ArgIdx].ConversionKind if (Candidate.Conversions[ArgIdx].ConversionKind
== ImplicitConversionSequence::BadConversion) { == ImplicitConversionSequence::BadConversion) {