1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 namespace A { // expected-note 2 {{previous definition is here}}
3 int A;
f()4 void f() { A = 0; }
5 }
6
f()7 void f() { A = 0; } // expected-error {{unexpected namespace name 'A': expected expression}}
8 int A; // expected-error {{redefinition of 'A' as different kind of symbol}}
9 class A; // expected-error {{redefinition of 'A' as different kind of symbol}}
10
11 class B {}; // expected-note {{previous definition is here}} \
12 // expected-note{{candidate function (the implicit copy assignment operator)}}
13
14 void C(); // expected-note {{previous definition is here}}
15 namespace C {} // expected-error {{redefinition of 'C' as different kind of symbol}}
16
17 namespace D {
18 class D {};
19 }
20
21 namespace S1 {
22 int x;
23
24 namespace S2 {
25
26 namespace S3 {
27 B x;
28 }
29 }
30 }
31
32 namespace S1 {
f()33 void f() {
34 x = 0;
35 }
36
37 namespace S2 {
38
39 namespace S3 {
f()40 void f() {
41 x = 0; // expected-error {{no viable overloaded '='}}
42 }
43 }
44
45 int y;
46 }
47 }
48
49 namespace S1 {
50 namespace S2 {
51 namespace S3 {
f3()52 void f3() {
53 y = 0;
54 }
55 }
56 }
57 }
58
59 namespace B {} // expected-error {{redefinition of 'B' as different kind of symbol}}
60
61
62 namespace foo {
63 enum x {
64 Y
65 };
66 }
67
68 static foo::x test1; // ok
69
70 static foo::X test2; // typo: expected-error {{no type named 'X' in}}
71
72 namespace PR6620 {
73 namespace numeric {
74 namespace op {
75 struct greater {};
76 }
77 namespace {
78 extern op::greater const greater;
79 }
80 }
81
82 namespace numeric {
83 namespace {
84 op::greater const greater = op::greater();
85 }
86
87 template<typename T, typename U>
f(T & l,U & r)88 int f(T& l, U& r)
89 { numeric::greater(l, r); }
90
91 }
92 }
93