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