Home | History | Annotate | Download | only in namespace.unnamed
      1 // RUN: %clang_cc1 -emit-llvm-only -verify %s
      2 
      3 // This lame little test was ripped straight from the standard.
      4 namespace {
      5   int i; // expected-note {{candidate}}
      6 }
      7 void test0() { i++; }
      8 
      9 namespace A {
     10   namespace {
     11     int i; // expected-note {{candidate}}
     12     int j;
     13   }
     14   void test1() { i++; }
     15 }
     16 
     17 using namespace A;
     18 
     19 void test2() {
     20   i++; // expected-error {{reference to 'i' is ambiguous}}
     21   A::i++;
     22   j++;
     23 }
     24 
     25 
     26 // Test that all anonymous namespaces in a translation unit are
     27 // considered the same context.
     28 namespace {
     29   class Test3 {}; // expected-note {{previous definition}}
     30 }
     31 namespace {
     32   class Test3 {}; // expected-error {{redefinition of 'Test3'}}
     33 }
     34 
     35 namespace test4 {
     36   namespace {
     37     class Test4 {}; // expected-note {{previous definition}}
     38   }
     39   namespace {
     40     class Test4 {}; // expected-error {{redefinition of 'Test4'}}
     41   }
     42 }
     43