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
; }
51 namespace A3::extra::specifiers
= A2
; // expected-error {{alias must be a single identifier}}
60 namespace B
{ void func (); }
73 namespace KA
{ void func(); }
80 template <class T
> void g() {
84 template void g
<int>();
85 template void g
<long>();
88 KB::func(); // expected-error {{undeclared identifier 'KB'}}
89 KC::func(); // expected-error {{undeclared identifier 'KC'}}
133 namespace X
= PR25731
;
134 namespace X
= PR25731
;
139 namespace MultipleUnambiguousLookupResults
{
140 namespace A
{ int y
; }
142 namespace X
{ int x
; }
144 namespace Z
= A
; // expected-note {{candidate}}
149 namespace Z
= X
; // expected-note {{candidate}}
153 int x1
= X::x
; // ok, unambiguous
154 int y1
= Y::y
; // ok, unambiguous
155 int z1
= Z::x
; // expected-error {{ambiguous}}
159 int x2
= X::x
; // ok, unambiguous
160 int y2
= Y::y
; // ok, unambiguous
163 namespace RedeclOfNonNamespace
{
164 int a
; // expected-note {{previous}}
165 namespace X
{ int b
; }
166 using X::b
; // expected-note {{previous}}
167 namespace c
{} // expected-note {{previous}}
169 namespace a
= X
; // expected-error {{different kind}}
170 namespace b
= X
; // expected-error {{different kind}}
171 namespace c
= X
; // expected-error-re {{redefinition of 'c'{{$}}}}