Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / dcl.dcl / basic.namespace / namespace.def / namespace.unnamed / p1.cpp
blobb4ec585e48e35c36181e1c851f1f1528a79ca0eb
1 // RUN: %clang_cc1 -emit-llvm-only -verify %s
3 // This lame little test was ripped straight from the standard.
4 namespace {
5 int i; // expected-note {{candidate}}
7 void test0() { i++; }
9 namespace A {
10 namespace {
11 int i; // expected-note {{candidate}}
12 int j;
14 void test1() { i++; }
17 using namespace A;
19 void test2() {
20 i++; // expected-error {{reference to 'i' is ambiguous}}
21 A::i++;
22 j++;
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}}
31 namespace {
32 class Test3 {}; // expected-error {{redefinition of 'Test3'}}
35 namespace test4 {
36 namespace {
37 class Test4 {}; // expected-note {{previous definition}}
39 namespace {
40 class Test4 {}; // expected-error {{redefinition of 'Test4'}}