Introduce support for C++0x explicit conversion operators (N2437)
Small cleanup in the handling of user-defined conversions.
Also, implement an optimization when constructing a call. We avoid
recomputing implicit conversion sequences and instead use those
conversion sequences that we computed as part of overload resolution.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62231 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 0c97611..f802f51 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1873,7 +1873,7 @@
}
if (CheckInitializerTypes(literalExpr, literalType, LParenLoc,
- DeclarationName()))
+ DeclarationName(), /*FIXME:DirectInit=*/false))
return true;
bool isFileScope = getCurFunctionOrMethodDecl() == 0;
@@ -3546,10 +3546,10 @@
// We matched a built-in operator. Convert the arguments, then
// break out so that we will build the appropriate built-in
// operator node.
- if (PerformCopyInitialization(lhs, Best->BuiltinTypes.ParamTypes[0],
- "passing") ||
- PerformCopyInitialization(rhs, Best->BuiltinTypes.ParamTypes[1],
- "passing"))
+ if (PerformImplicitConversion(lhs, Best->BuiltinTypes.ParamTypes[0],
+ Best->Conversions[0], "passing") ||
+ PerformImplicitConversion(rhs, Best->BuiltinTypes.ParamTypes[1],
+ Best->Conversions[1], "passing"))
return true;
break;
@@ -3644,8 +3644,8 @@
// We matched a built-in operator. Convert the arguments, then
// break out so that we will build the appropriate built-in
// operator node.
- if (PerformCopyInitialization(Input, Best->BuiltinTypes.ParamTypes[0],
- "passing"))
+ if (PerformImplicitConversion(Input, Best->BuiltinTypes.ParamTypes[0],
+ Best->Conversions[0], "passing"))
return true;
break;