aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r--lib/Sema/SemaInit.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 445cd691d6..29113822f7 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -176,9 +176,10 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
DirectInit? IK_Direct : IK_Copy);
if (!Constructor)
return true;
-
+ bool Elidable = (isa<CallExpr>(Init) ||
+ isa<CXXTemporaryObjectExpr>(Init));
Init = BuildCXXConstructExpr(Context,
- DeclType, Constructor, false, &Init, 1);
+ DeclType, Constructor, Elidable, &Init, 1);
Init = MaybeCreateCXXExprWithTemporaries(Init, /*DestroyTemps=*/true);
return false;
}