blob: df0fa253ef5cca87c9ca71b406690f543f8a8d8c [file] [log] [blame]
Ted Kremenekdd6cec12008-04-29 04:43:50 +00001// RUN: clang -fsyntax-only -verify %s
2namespace A { // expected-error {{error: previous definition is here}}
3 int A;
4 void f() { A = 0; }
5}
6
7void f() { A = 0; } // expected-error {{error: unexpected namespace name 'A': expected expression}}
8int A; // expected-error {{error: redefinition of 'A' as different kind of symbol}}
9class A; // expected-error {{error: redefinition of 'A' as different kind of symbol}}
10
Argyrios Kyrtzidis00bc6452008-05-09 23:39:43 +000011class B {}; // expected-error {{error: previous definition is here}}
Ted Kremenekdd6cec12008-04-29 04:43:50 +000012namespace B {} // expected-error {{error: redefinition of 'B' as different kind of symbol}}
13
14void C(); // expected-error {{error: previous definition is here}}
15namespace C {} // expected-error {{error: redefinition of 'C' as different kind of symbol}}
Argyrios Kyrtzidis00bc6452008-05-09 23:39:43 +000016
17namespace S1 {
18 int x;
19
20 namespace S2 {
21
22 namespace S3 {
23 B x;
24 }
25 }
26}
27
28namespace S1 {
29 void f() {
30 x = 0;
31 }
32
33 namespace S2 {
34
35 namespace S3 {
36 void f() {
37 x = 0; // expected-error {{error: incompatible type assigning 'int', expected 'class B'}}
38 }
39 }
40
41 int y;
42 }
43}
44
45namespace S1 {
46 namespace S2 {
47 namespace S3 {
48 void f3() {
49 y = 0;
50 }
51 }
52 }
53}