aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.prim/expr.prim.lambda
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-05-16 16:50:20 +0000
committerDouglas Gregor <dgregor@apple.com>2012-05-16 16:50:20 +0000
commit29a93f810ae5277446f610e8b6cdf0985febb989 (patch)
tree58f6311ea3dc93f8dcfbc20b750e3ce9cf9a488c /test/CXX/expr/expr.prim/expr.prim.lambda
parentd0792de17387e949c27f97a5fa4a0b3e82db9b1e (diff)
Fix code generation of variables reference expressions when mixing
blocks and lambdas, based heavily on a patch from Meador Inge. Fixes PR12746 / <rdar://problem/11465120>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156925 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda')
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/blocks.mm22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.mm b/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.mm
index 0c3fdb2d80..941443a0d6 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.mm
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.mm
@@ -86,3 +86,25 @@ namespace overloading {
int &ir = accept_lambda_conv([](int x) { return x + 1; });
}
}
+
+namespace PR12746 {
+ bool f1(int *x) {
+ bool (^outer)() = ^ {
+ auto inner = [&]() -> bool {
+ return x == 0;
+ };
+ return inner();
+ };
+ return outer();
+ }
+
+ bool f2(int *x) {
+ auto outer = [&]() -> bool {
+ bool (^inner)() = ^ {
+ return x == 0;
+ };
+ return inner();
+ };
+ return outer();
+ }
+}