2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-06-24 08:10:43 +08:00
|
|
|
|
|
|
|
int x;
|
|
|
|
void f()
|
|
|
|
{
|
|
|
|
static int s;
|
|
|
|
int x; // expected-note{{'x' declared here}}
|
|
|
|
extern int g();
|
|
|
|
|
|
|
|
struct local {
|
2012-02-07 08:15:00 +08:00
|
|
|
int g() { return x; } // expected-error{{reference to local variable 'x' declared in enclosing function 'f'}}
|
2009-06-24 08:10:43 +08:00
|
|
|
int h() { return s; }
|
|
|
|
int k() { return :: x; }
|
|
|
|
int l() { return g(); }
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
local* p = 0; // expected-error{{unknown type name 'local'}}
|