When we create an implicit CXXTemporaryObjectExpr we don't need to check that it's a valid init. Instead, just set it as the VarDecl's initializer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69292 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 5e781f9..3cfa8ae 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1827,10 +1827,6 @@
if (!Constructor)
RealDecl->setInvalidDecl();
else {
-#if 0
- // FIXME: Adding the initializer causes an error in
- // test/SemaCXX/default2.cpp so it's disabled for now.
-
// Let clients know that initialization was done with a direct
// initializer.
VDecl->setCXXDirectInitializer(true);
@@ -1841,8 +1837,7 @@
(Expr**)Exprs.release(),
NumExprs,
SourceLocation());
- AddInitializerToDecl(Dcl, ExprArg(*this, Temp), /*DirectInit=*/true);
-#endif
+ VDecl->setInit(Temp);
}
return;
}