brintos

brintos / llvm-project-archived public Read only

0
0
Text · 912 B · 5045bac Raw
36 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3namespace A {4  struct x {}; // expected-note {{candidate found by name lookup is 'A::x'}}5  int x; // expected-note {{candidate found by name lookup is 'A::x'}}6 7  struct y {}; // expected-note {{type declaration hidden}}8 9  struct z;10  void z(float);11}12 13namespace B {14  struct x {}; // expected-note {{candidate found by name lookup is 'B::x'}}15  float x; // expected-note {{candidate found by name lookup is 'B::x'}}16 17  float y; // expected-note {{declaration hides type}}18 19  void z(int);20}21 22namespace AB {23  using namespace A;24  using namespace B;25}26 27void test() {28  struct AB::x foo; // expected-error {{reference to 'x' is ambiguous}}29  int i = AB::x; // expected-error {{reference to 'x' is ambiguous}}30 31  struct AB::y bar;32  float f = AB::y; // expected-error {{a type named 'y' is hidden by a declaration in a different namespace}}33  AB::z(i);34  AB::z(f);35}36