aboutsummaryrefslogtreecommitdiff
path: root/test/Modules/namespaces.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-09 17:30:44 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-09 17:30:44 +0000
commitc6c8e0ec96bb64f1b9f543d7c8317c6090f80a30 (patch)
tree39aea2b30aebc4a42f967293a8e28181ab8fc20e /test/Modules/namespaces.cpp
parentc02d62f0b82c144f7db2a71c3b4565de8c6163e5 (diff)
Implement redeclaration merging for namespaces defined in distinct
modules. Teach name lookup into namespaces to search in each of the merged DeclContexts as well as the (now-primary) DeclContext. This supports the common case where two different modules put something into the same namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147778 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules/namespaces.cpp')
-rw-r--r--test/Modules/namespaces.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Modules/namespaces.cpp b/test/Modules/namespaces.cpp
index 75557ba4c1..e1a8d6e8b0 100644
--- a/test/Modules/namespaces.cpp
+++ b/test/Modules/namespaces.cpp
@@ -1,6 +1,10 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs %s -verify
+namespace N6 {
+ char &f(char);
+}
+
@import namespaces_left;
@import namespaces_right;
@@ -13,3 +17,20 @@ void test() {
double &dr1 = N2::f(1.0);
double &dr2 = N3::f(1.0);
}
+
+// Test namespaces merged without a common first declaration.
+namespace N5 {
+ char &f(char);
+}
+
+void testMerged() {
+ int &ir1 = N5::f(17);
+ int &ir2 = N6::f(17);
+ int &ir3 = N7::f(17);
+ double &fr1 = N5::f(1.0);
+ double &fr2 = N6::f(1.0);
+ double &fr3 = N7::f(1.0);
+ char &cr1 = N5::f('a');
+ char &cr2 = N6::f('b');
+}
+