ir-gen related patch for type conversion
with class type conversion methods. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80365 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index cdda6ab..061ac8d 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -228,12 +228,15 @@
if (CheckCastTypes(TypeRange, Ty, Exprs[0], Kind, ConversionDecl,
/*functional-style*/true))
return ExprError();
- exprs.release();
- return Owned(new (Context) CXXFunctionalCastExpr(Ty.getNonReferenceType(),
+ // We done't build this AST for X(i) where we are constructing an object.
+ if (!ConversionDecl || !isa<CXXConstructorDecl>(ConversionDecl)) {
+ exprs.release();
+ return Owned(new (Context) CXXFunctionalCastExpr(Ty.getNonReferenceType(),
Ty, TyBeginLoc,
CastExpr::CK_UserDefinedConversion,
Exprs[0], ConversionDecl,
RParenLoc));
+ }
}
if (const RecordType *RT = Ty->getAs<RecordType>()) {