AST for conversion by conversion functions. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80135 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 2b0749ae..ae5010c 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -216,9 +216,10 @@
return ExprError();
exprs.release();
return Owned(new (Context) CXXFunctionalCastExpr(Ty.getNonReferenceType(),
- Ty, TyBeginLoc, Kind,
- Exprs[0], ConversionDecl,
- RParenLoc));
+ Ty, TyBeginLoc,
+ CastExpr::CK_UserDefinedConversion,
+ Exprs[0], ConversionDecl,
+ RParenLoc));
}
if (const RecordType *RT = Ty->getAs<RecordType>()) {
@@ -906,9 +907,16 @@
break;
case ImplicitConversionSequence::UserDefinedConversion:
- // FIXME: This is, of course, wrong. We'll need to actually call the
- // constructor or conversion operator, and then cope with the standard
- // conversions.
+ // FIXME. Support other kinds of user defined convesions.
+ if (CXXConversionDecl *CV =
+ dyn_cast<CXXConversionDecl>(ICS.UserDefined.ConversionFunction))
+ // FIXME. Get actual Source Location.
+ From =
+ new (Context) CXXFunctionalCastExpr(ToType.getNonReferenceType(),
+ ToType, SourceLocation(),
+ CastExpr::CK_UserDefinedConversion,
+ From, CV,
+ SourceLocation());
ImpCastExprToType(From, ToType.getNonReferenceType(),
CastExpr::CK_Unknown,
ToType->isLValueReferenceType());