xref: /minix3/external/bsd/llvm/dist/clang/test/CXX/class/class.local/p1.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc int x;
f()4*f4a2713aSLionel Sambuc void f()
5*f4a2713aSLionel Sambuc {
6*f4a2713aSLionel Sambuc   static int s;
7*f4a2713aSLionel Sambuc   int x; // expected-note{{'x' declared here}}
8*f4a2713aSLionel Sambuc   extern int g();
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc   struct local {
11*f4a2713aSLionel Sambuc     int g() { return x; } // expected-error{{reference to local variable 'x' declared in enclosing function 'f'}}
12*f4a2713aSLionel Sambuc     int h() { return s; }
13*f4a2713aSLionel Sambuc     int k() { return :: x; }
14*f4a2713aSLionel Sambuc     int l() { return g(); }
15*f4a2713aSLionel Sambuc   };
16*f4a2713aSLionel Sambuc }
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc local* p = 0; // expected-error{{unknown type name 'local'}}
19