1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 namespace N
{ struct X
{ }; };
7 int B
; // expected-note {{previous definition is here}}
8 namespace B
= N
; // expected-error {{redefinition of 'B' as different kind of symbol}}
10 namespace C
{ } // expected-note {{previous definition is here}}
11 namespace C
= N
; // expected-error {{redefinition of 'C'}}
15 i
; // expected-error {{expected namespace name}}
18 Foo
; // expected-error {{expected namespace name}}
20 X
; // expected-error {{expected namespace name}}
23 namespace A
{ namespace B
{ } } // expected-note {{candidate found by name lookup is 'F::A::B'}}
24 namespace B
{ } // expected-note {{candidate found by name lookup is 'F::B'}}
26 namespace D
= B
; // expected-error {{reference to 'B' is ambiguous}}
37 // These all point to A1.
41 namespace B
= C
; // expected-note {{previously defined as an alias for 'A1'}}
43 namespace B
= A2
; // expected-error {{redefinition of 'B' as an alias for a different namespace}}
47 namespace A1
{ int i
; }
58 namespace B
{ void func (); }
71 namespace KA
{ void func(); }
78 template <class T
> void g() {
82 template void g
<int>();
83 template void g
<long>();
86 KB::func(); // expected-error {{undeclared identifier 'KB'}}
87 KC::func(); // expected-error {{undeclared identifier 'KC'}}
131 namespace X
= PR25731
;
132 namespace X
= PR25731
;
137 namespace MultipleUnambiguousLookupResults
{
138 namespace A
{ int y
; }
140 namespace X
{ int x
; }
142 namespace Z
= A
; // expected-note {{candidate}}
147 namespace Z
= X
; // expected-note {{candidate}}
151 int x1
= X::x
; // ok, unambiguous
152 int y1
= Y::y
; // ok, unambiguous
153 int z1
= Z::x
; // expected-error {{ambiguous}}
157 int x2
= X::x
; // ok, unambiguous
158 int y2
= Y::y
; // ok, unambiguous
161 namespace RedeclOfNonNamespace
{
162 int a
; // expected-note {{previous}}
163 namespace X
{ int b
; }
164 using X::b
; // expected-note {{previous}}
165 namespace c
{} // expected-note {{previous}}
167 namespace a
= X
; // expected-error {{different kind}}
168 namespace b
= X
; // expected-error {{different kind}}
169 namespace c
= X
; // expected-error-re {{redefinition of 'c'{{$}}}}