summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLambda.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-04-06 12:53:43 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-04-06 12:53:43 +0000
commitb4791c7595eb1637c6371b1ec30756631c2c7f32 (patch)
treefa11b0602ee05827d7a53c2ec57cbf0b4f7418e4 /clang/lib/Sema/SemaLambda.cpp
parente228f68811ffe816faaa892b27dafb788393aba8 (diff)
downloadbcm5719-llvm-b4791c7595eb1637c6371b1ec30756631c2c7f32.tar.gz
bcm5719-llvm-b4791c7595eb1637c6371b1ec30756631c2c7f32.zip
Fix lambda to block conversion in C++17 by avoiding copy elision for the
lambda capture used by the created block The commit r288866 introduced guaranteed copy elision to C++ 17. This unfortunately broke the lambda to block conversion in C++17 (the compiler crashes when performing IRGen). This commit fixes the conversion by avoiding copy elision for the capture that captures the lambda that's used in the block created by the lambda to block conversion process. rdar://31385153 Differential Revision: https://reviews.llvm.org/D31669 llvm-svn: 299646
Diffstat (limited to 'clang/lib/Sema/SemaLambda.cpp')
-rw-r--r--clang/lib/Sema/SemaLambda.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index 2b13f2af685..7a9a8ff911a 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -1649,10 +1649,9 @@ ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation,
CallOperator->markUsed(Context);
ExprResult Init = PerformCopyInitialization(
- InitializedEntity::InitializeBlock(ConvLocation,
- Src->getType(),
- /*NRVO=*/false),
- CurrentLocation, Src);
+ InitializedEntity::InitializeLambdaToBlock(ConvLocation, Src->getType(),
+ /*NRVO=*/false),
+ CurrentLocation, Src);
if (!Init.isInvalid())
Init = ActOnFinishFullExpr(Init.get());
OpenPOWER on IntegriCloud