bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old);
/// C++ Overloading.
- enum OverloadResolutionFlags {
- ORF_None = 0x0,
- ORF_SuppressUserConversions = 0x1,
- ORF_AllowExplicit = 0x2,
- ORF_ForceRValue = 0x4
- };
-
bool IsOverload(FunctionDecl *New, Decl* OldD,
OverloadedFunctionDecl::function_iterator &MatchedDecl);
ImplicitConversionSequence
- TryImplicitConversion(Expr* From, QualType ToType, unsigned Flags = ORF_None);
+ TryImplicitConversion(Expr* From, QualType ToType,
+ bool SuppressUserConversions = false,
+ bool AllowExplicit = false,
+ bool ForceRValue = false);
bool IsStandardConversion(Expr *From, QualType ToType,
StandardConversionSequence& SCS);
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
// 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,
- SuppressUserConversions ?
- ORF_SuppressUserConversions :
- ORF_None);
+ *ICS = TryImplicitConversion(Init, T1, SuppressUserConversions);
// Of course, that's still a reference binding.
if (ICS->ConversionKind == ImplicitConversionSequence::StandardConversion) {
ICS->Standard.ReferenceBinding = true;
const char *Flavor, bool AllowExplicit,
bool Elidable)
{
- unsigned Flags = ORF_None;
- if (AllowExplicit)
- Flags |= ORF_AllowExplicit;
-
ImplicitConversionSequence ICS;
ICS.ConversionKind = ImplicitConversionSequence::BadConversion;
if (Elidable && getLangOptions().CPlusPlus0x) {
- Flags |= ORF_ForceRValue;
-
- ICS = TryImplicitConversion(From, ToType, Flags);
+ ICS = TryImplicitConversion(From, ToType, /*SuppressUserConversions*/false,
+ AllowExplicit, /*ForceRValue*/true);
}
if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion) {
- ICS = TryImplicitConversion(From, ToType, Flags);
+ ICS = TryImplicitConversion(From, ToType, false, AllowExplicit);
}
return PerformImplicitConversion(From, ToType, ICS, Flavor);
}
/// If @p ForceRValue, then overloading is performed as if From was an rvalue,
/// no matter its actual lvalueness.
ImplicitConversionSequence
-Sema::TryImplicitConversion(Expr* From, QualType ToType, unsigned Flags) {
- bool SuppressUserConversions = Flags & ORF_SuppressUserConversions;
- bool AllowExplicit = Flags & ORF_AllowExplicit;
- bool ForceRValue = Flags & ORF_ForceRValue;
-
+Sema::TryImplicitConversion(Expr* From, QualType ToType,
+ bool SuppressUserConversions,
+ bool AllowExplicit, bool ForceRValue)
+{
ImplicitConversionSequence ICS;
if (IsStandardConversion(From, ToType, ICS.Standard))
ICS.ConversionKind = ImplicitConversionSequence::StandardConversion;
/*AllowExplicit=*/false, ForceRValue);
return ICS;
} else {
- unsigned Flags = ORF_None;
- if (SuppressUserConversions) Flags |= ORF_SuppressUserConversions;
- if (ForceRValue) Flags |= ORF_ForceRValue;
-
- return TryImplicitConversion(From, ToType, Flags);
+ return TryImplicitConversion(From, ToType, SuppressUserConversions,
+ ForceRValue);
}
}
/// TryContextuallyConvertToBool - Attempt to contextually convert the
/// expression From to bool (C++0x [conv]p3).
ImplicitConversionSequence Sema::TryContextuallyConvertToBool(Expr *From) {
- return TryImplicitConversion(From, Context.BoolTy, ORF_AllowExplicit);
+ return TryImplicitConversion(From, Context.BoolTy, false, true);
}
/// PerformContextuallyConvertToBool - Perform a contextual conversion