diff options
Diffstat (limited to 'test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp')
-rw-r--r-- | test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp index dd30d6ad4f98..b4ec585e48e3 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp @@ -1,7 +1,6 @@ -// RUN: clang-cc -emit-llvm-only -verify %s +// RUN: %clang_cc1 -emit-llvm-only -verify %s // This lame little test was ripped straight from the standard. - namespace { int i; // expected-note {{candidate}} } @@ -22,3 +21,22 @@ void test2() { A::i++; j++; } + + +// Test that all anonymous namespaces in a translation unit are +// considered the same context. +namespace { + class Test3 {}; // expected-note {{previous definition}} +} +namespace { + class Test3 {}; // expected-error {{redefinition of 'Test3'}} +} + +namespace test4 { + namespace { + class Test4 {}; // expected-note {{previous definition}} + } + namespace { + class Test4 {}; // expected-error {{redefinition of 'Test4'}} + } +} |