43 lines · cpp
1// RUN: %clang_cc1 -emit-llvm-only -verify %s2 3// This lame little test was ripped straight from the standard.4namespace {5 int i; // expected-note {{candidate}}6}7void test0() { i++; }8 9namespace A {10 namespace {11 int i; // expected-note {{candidate}}12 int j;13 }14 void test1() { i++; }15}16 17using namespace A;18 19void 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 are27// considered the same context.28namespace {29 class Test3 {}; // expected-note {{previous definition}}30}31namespace {32 class Test3 {}; // expected-error {{redefinition of 'Test3'}}33}34 35namespace test4 {36 namespace {37 class Test4 {}; // expected-note {{previous definition}}38 }39 namespace {40 class Test4 {}; // expected-error {{redefinition of 'Test4'}}41 }42}43