diff options
| author | Douglas Gregor <dgregor@apple.com> | 2012-01-09 18:07:24 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2012-01-09 18:07:24 +0000 |
| commit | 540fd8135ec592720caeb29ba5a0984b922515fe (patch) | |
| tree | 10a0f8125ebb0af29739f6e597de156ee3f9836f /clang/test | |
| parent | fa8df4837af316d93b3f815894f0c4d2bd071619 (diff) | |
| download | bcm5719-llvm-540fd8135ec592720caeb29ba5a0984b922515fe.tar.gz bcm5719-llvm-540fd8135ec592720caeb29ba5a0984b922515fe.zip | |
When deserializing an anonymous namespace from a module, do not attach
the anonymous namespace to its parent. Semantically, this means that
the anonymous namespaces defined in one module are distinct from the
anonymous namespaces defined in another module.
llvm-svn: 147782
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Modules/Inputs/namespaces-left.h | 14 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/namespaces-right.h | 20 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/namespaces-top.h | 3 | ||||
| -rw-r--r-- | clang/test/Modules/namespaces.cpp | 11 |
4 files changed, 48 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/namespaces-left.h b/clang/test/Modules/Inputs/namespaces-left.h index ea2ae2b9ced..7e9002aea8c 100644 --- a/clang/test/Modules/Inputs/namespaces-left.h +++ b/clang/test/Modules/Inputs/namespaces-left.h @@ -37,3 +37,17 @@ namespace N9 { namespace N10 { int &f(int); } + +namespace N11 { + namespace { + class Foo; + } + Foo *getFoo(); +} + +namespace N12 { + namespace { + class Foo; + } + Foo *getFoo(); +} diff --git a/clang/test/Modules/Inputs/namespaces-right.h b/clang/test/Modules/Inputs/namespaces-right.h index d103c00c820..b18aeb44786 100644 --- a/clang/test/Modules/Inputs/namespaces-right.h +++ b/clang/test/Modules/Inputs/namespaces-right.h @@ -39,3 +39,23 @@ namespace N9 { namespace N10 { int &f(int); } + + + + + + + +namespace N11 { + namespace { + class Foo; + } + void consumeFoo(Foo*); +} + +namespace N12 { + namespace { + class Foo; + } + void consumeFoo(Foo*); +} diff --git a/clang/test/Modules/Inputs/namespaces-top.h b/clang/test/Modules/Inputs/namespaces-top.h index a69f43f1833..0c607f52851 100644 --- a/clang/test/Modules/Inputs/namespaces-top.h +++ b/clang/test/Modules/Inputs/namespaces-top.h @@ -9,3 +9,6 @@ namespace N2 { namespace N3 { int& f(int); } + +namespace N12 { } + diff --git a/clang/test/Modules/namespaces.cpp b/clang/test/Modules/namespaces.cpp index 9ef966ac019..b60f75cff60 100644 --- a/clang/test/Modules/namespaces.cpp +++ b/clang/test/Modules/namespaces.cpp @@ -47,3 +47,14 @@ void testMergedMerged() { int &ir2 = N9::f(17); int &ir3 = N10::f(17); } + +// Test merging when using anonymous namespaces, which does not +// actually perform any merging. +// other file: expected-note{{passing argument to parameter here}} +void testAnonymousNotMerged() { + N11::consumeFoo(N11::getFoo()); // expected-error{{cannot initialize a parameter of type 'N11::<anonymous>::Foo *' with an rvalue of type 'N11::<anonymous>::Foo *'}} + N12::consumeFoo(N12::getFoo()); // expected-error{{cannot initialize a parameter of type 'N12::<anonymous>::Foo *' with an rvalue of type 'N12::<anonymous>::Foo *'}} +} + + +// other file: expected-note{{passing argument to parameter here}} |

