blob: c2ab25c5c26cb70d8459b24d57f9572e551518e9 [file] [log] [blame]
John McCall9a8cb8d2010-03-16 21:50:59 +00001// RUN: %clang_cc1 -verify -fsyntax-only -Wshadow %s
2
3namespace {
4 int i; // expected-note {{previous declaration is here}}
5}
6
7namespace one {
8namespace two {
9 int j; // expected-note {{previous declaration is here}}
10}
11}
12
13namespace xx {
14 int m;
15}
16namespace yy {
17 int m;
18}
19
20using namespace one::two;
21using namespace xx;
22using namespace yy;
23
24void foo() {
25 int i; // expected-warning {{declaration shadows a variable in namespace '<anonymous>'}}
26 int j; // expected-warning {{declaration shadows a variable in namespace 'one::two'}}
27 int m;
28}
29
30class A {
31 static int data; // expected-note {{previous declaration}}
32 int field; // expected-note {{previous declaration}}
33
34 void test() {
35 char *field; // expected-warning {{declaration shadows a field of 'A'}}
36 char *data; // expected-warning {{declaration shadows a static data member of 'A'}}
37 }
38};
John McCalla369a952010-03-20 04:12:52 +000039
40// TODO: this should warn, <rdar://problem/5018057>
41class B : A {
42 int data;
43 static int field;
44};
Argyrios Kyrtzidis36eb5e42011-01-31 07:04:54 +000045
46// rdar://8900456
47namespace rdar8900456 {
48struct Foo {
49 static void Baz();
50private:
51 int Bar;
52};
53
54void Foo::Baz() {
55 double Bar = 12; // Don't warn.
56}
57}