Home | History | Annotate | Download | only in Parser
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 class A {};
      4 
      5 namespace B {
      6   namespace A {} // expected-note{{namespace '::B::A' defined here}} \
      7                  // expected-note 2{{namespace 'B::A' defined here}}
      8   using namespace A ;
      9 }
     10 
     11 namespace C {} // expected-note{{namespace 'C' defined here}}
     12 
     13 namespace D {
     14 
     15   class C {
     16 
     17     using namespace B ; // expected-error{{not allowed}}
     18   };
     19 
     20   namespace B {}
     21 
     22   using namespace C ;
     23   using namespace B::A ; // expected-error{{no namespace named 'A' in namespace 'D::B'; did you mean '::B::A'?}}
     24   using namespace ::B::A ;
     25   using namespace ::D::F ; // expected-error{{expected namespace name}}
     26   using namespace ::D::C ; // expected-error{{no namespace named 'C' in namespace 'D'; did you mean simply 'C'?}}
     27 }
     28 
     29 using namespace ! ; // expected-error{{expected namespace name}}
     30 using namespace A ; // expected-error{{no namespace named 'A'; did you mean 'B::A'?}}
     31 using namespace ::A // expected-error{{no namespace named 'A' in the global namespace; did you mean 'B::A'?}} \
     32                     // expected-error{{expected ';' after namespace name}}
     33                     B ;
     34 
     35 void test_nslookup() {
     36   int B;
     37   class C;
     38   using namespace B;
     39   using namespace C;
     40 }
     41