Home | History | Annotate | Download | only in namespace.udecl
      1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
      2 // C++0x N2914.
      3 
      4 struct B {
      5   void f(char);
      6   void g(char);
      7   enum E { e };
      8   union { int x; };
      9 };
     10 
     11 class C {
     12   int g();
     13 };
     14 
     15 class D2 : public B {
     16   using B::f;
     17   using B::e;
     18   using B::x;
     19   using C::g; // expected-error{{using declaration refers into 'C::', which is not a base class of 'D2'}}
     20 };
     21 
     22 namespace test1 {
     23   struct Base {
     24     int foo();
     25   };
     26 
     27   struct Unrelated {
     28     int foo();
     29   };
     30 
     31   struct Subclass : Base {
     32   };
     33 
     34   namespace InnerNS {
     35     int foo();
     36   }
     37 
     38   // We should be able to diagnose these without instantiation.
     39   template <class T> struct C : Base {
     40     using InnerNS::foo; // expected-error {{not a class}}
     41     using Base::bar; // expected-error {{no member named 'bar'}}
     42     using Unrelated::foo; // expected-error {{not a base class}}
     43     using C::foo; // expected-error {{refers to its own class}}
     44     using Subclass::foo; // expected-error {{not a base class}}
     45   };
     46 }
     47