diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-01 00:09:55 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-01 00:09:55 +0000 |
commit | fe9b559f81535ade84d24c42569378f80df47847 (patch) | |
tree | 1e63c2da8092873ef64366ecd5100459ff4553e6 /test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp | |
parent | 48b68a0dc345b3208cbd9dda719b9b3ec167c8c2 (diff) |
Diagnose attempts to explicitly capture a __block variable in a lambda.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149458 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp')
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp new file mode 100644 index 0000000000..faf686d111 --- /dev/null +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -std=c++11 -fblocks %s -verify + +void block_capture_errors() { + __block int var; // expected-note 2{{'var' declared here}} + (void)[var] { }; // expected-error{{__block variable 'var' cannot be captured in a lambda}} \ + // expected-error{{lambda expressions are not supported yet}} + + // FIXME: this should produce the same error as above + (void)[=] { var = 17; }; // expected-error{{reference to local variable 'var' declared in enclosed function 'block_capture_errors'}} \ + // expected-error{{lambda expressions are not supported yet}} +} |