aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp')
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp
index b596bd5324..245e27042b 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp
@@ -23,3 +23,18 @@ class X0 {
(void)[&Variable] () {}; // expected-error {{use of undeclared identifier 'Variable'; did you mean 'variable'}}
}
};
+
+void test_reaching_scope() {
+ int local; // expected-note{{declared here}}
+ static int local_static; // expected-note{{'local_static' declared here}}
+ (void)[=]() {
+ struct InnerLocal {
+ void member() {
+ (void)[local, // expected-error{{reference to local variable 'local' declared in enclosing function 'test_reaching_scope'}}
+ local_static]() { // expected-error{{'local_static' cannot be captured because it does not have automatic storage duration}}
+ return 0;
+ };
+ }
+ };
+ };
+}