Skip to content
Snippets Groups Projects
Commit f5f4d2fd authored by Eli Friedman's avatar Eli Friedman
Browse files

Make sure the __invoke function for lambdas returns properly. Per bug report on IRC>

llvm-svn: 170160
parent 7bb2f97a
No related branches found
No related tags found
No related merge requests found
...@@ -1787,6 +1787,8 @@ void CodeGenFunction::EmitForwardingCallToLambda(const CXXRecordDecl *lambda, ...@@ -1787,6 +1787,8 @@ void CodeGenFunction::EmitForwardingCallToLambda(const CXXRecordDecl *lambda,
// If necessary, copy the returned value into the slot. // If necessary, copy the returned value into the slot.
if (!resultType->isVoidType() && returnSlot.isNull()) if (!resultType->isVoidType() && returnSlot.isNull())
EmitReturnOfRValue(RV, resultType); EmitReturnOfRValue(RV, resultType);
else
EmitBranchThroughCleanup(ReturnBlock);
} }
void CodeGenFunction::EmitLambdaBlockInvokeBody() { void CodeGenFunction::EmitLambdaBlockInvokeBody() {
......
...@@ -80,6 +80,15 @@ int g() { ...@@ -80,6 +80,15 @@ int g() {
return [] { return r; } (); return [] { return r; } ();
}; };
// CHECK: define internal void @"_ZZ1hvEN3$_78__invokeEv"(%struct.A* noalias sret %agg.result)
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @"_ZZ1hvENK3$_7clEv"(%struct.A* sret %agg.result,
// CHECK-NEXT: ret void
struct A { ~A(); };
void h() {
A (*h)() = [] { return A(); };
}
// CHECK: define internal i32 @"_ZZ1fvEN3$_58__invokeEii" // CHECK: define internal i32 @"_ZZ1fvEN3$_58__invokeEii"
// CHECK: store i32 // CHECK: store i32
// CHECK-NEXT: store i32 // CHECK-NEXT: store i32
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment