summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 445cd691d6a..29113822f73 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud