1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
2 | |
3 | void f() { |
4 | int x = 3; // expected-note{{'x' declared here}} |
5 | const int c = 2; |
6 | struct C { |
7 | int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing function 'f'}} |
8 | int cc = c; |
9 | }; |
10 | (void)[]() mutable { |
11 | int x = 3; // expected-note{{'x' declared here}} |
12 | struct C { |
13 | int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing lambda expression}} |
14 | }; |
15 | }; |
16 | C(); |
17 | } |
18 | |
19 | |