diff options
Diffstat (limited to 'clang/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp')
| -rw-r--r-- | clang/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp index 3301b29135d..f6a8db23e9b 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp @@ -33,3 +33,25 @@ void conversion_to_block_init(ConstCopyConstructorBoom<int> boom, const auto& lambda2([=] { boom2.foo(); }); // expected-note{{in instantiation of member function}} void (^block)(void) = lambda2; } + + +void nesting() { + int array[7]; // expected-note 2{{'array' declared here}} + [=] () mutable { + [&] { + ^ { + int i = array[2]; + i += array[3]; + }(); + }(); + }(); + + [&] { + [=] () mutable { + ^ { + int i = array[2]; // expected-error{{cannot refer to declaration with an array type inside block}} + i += array[3]; // expected-error{{cannot refer to declaration with an array type inside block}} + }(); + }(); + }(); +} |

