Diagnose attempts to explicitly capture a __block variable in a lambda.
llvm-svn: 149458
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
new file mode 100644
index 0000000..faf686d
--- /dev/null
+++ b/clang/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}}
+}