xref: /llvm-project/clang/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p5.cpp (revision 8fbe78f6fc7b41d1a4228c126fcb522131150518)
1*8fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -fsyntax-only -verify %s
26538c930SJohn McCall 
36538c930SJohn McCall namespace A {
46538c930SJohn McCall   struct x {}; // expected-note {{candidate found by name lookup is 'A::x'}}
56538c930SJohn McCall   int x; // expected-note {{candidate found by name lookup is 'A::x'}}
66538c930SJohn McCall 
76538c930SJohn McCall   struct y {}; // expected-note {{type declaration hidden}}
86538c930SJohn McCall 
96538c930SJohn McCall   struct z;
106538c930SJohn McCall   void z(float);
116538c930SJohn McCall }
126538c930SJohn McCall 
136538c930SJohn McCall namespace B {
146538c930SJohn McCall   struct x {}; // expected-note {{candidate found by name lookup is 'B::x'}}
156538c930SJohn McCall   float x; // expected-note {{candidate found by name lookup is 'B::x'}}
166538c930SJohn McCall 
176538c930SJohn McCall   float y; // expected-note {{declaration hides type}}
186538c930SJohn McCall 
196538c930SJohn McCall   void z(int);
206538c930SJohn McCall }
216538c930SJohn McCall 
226538c930SJohn McCall namespace AB {
236538c930SJohn McCall   using namespace A;
246538c930SJohn McCall   using namespace B;
256538c930SJohn McCall }
266538c930SJohn McCall 
test()276538c930SJohn McCall void test() {
286538c930SJohn McCall   struct AB::x foo; // expected-error {{reference to 'x' is ambiguous}}
296538c930SJohn McCall   int i = AB::x; // expected-error {{reference to 'x' is ambiguous}}
306538c930SJohn McCall 
316538c930SJohn McCall   struct AB::y bar;
326538c930SJohn McCall   float f = AB::y; // expected-error {{a type named 'y' is hidden by a declaration in a different namespace}}
336538c930SJohn McCall   AB::z(i);
346538c930SJohn McCall   AB::z(f);
356538c930SJohn McCall }
36