xref: /minix3/external/bsd/llvm/dist/clang/test/CXX/class/class.local/p1-0x.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2*f4a2713aSLionel Sambuc 
f()3*f4a2713aSLionel Sambuc void f() {
4*f4a2713aSLionel Sambuc   int x = 3; // expected-note{{'x' declared here}}
5*f4a2713aSLionel Sambuc   const int c = 2;
6*f4a2713aSLionel Sambuc   struct C {
7*f4a2713aSLionel Sambuc     int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing function 'f'}}
8*f4a2713aSLionel Sambuc     int cc = c;
9*f4a2713aSLionel Sambuc   };
10*f4a2713aSLionel Sambuc   (void)[]() mutable {
11*f4a2713aSLionel Sambuc     int x = 3; // expected-note{{'x' declared here}}
12*f4a2713aSLionel Sambuc     struct C {
13*f4a2713aSLionel Sambuc       int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing lambda expression}}
14*f4a2713aSLionel Sambuc     };
15*f4a2713aSLionel Sambuc   };
16*f4a2713aSLionel Sambuc   C();
17*f4a2713aSLionel Sambuc }
18*f4a2713aSLionel Sambuc 
19