summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/namespace-alias.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-12-29 23:34:32 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-12-29 23:34:32 +0000
commitf2005d3de64f9230c6b43b4f4da1866d999446c8 (patch)
treefbeca65132ed366aae5a8e69cfac59bd1061bf2a /clang/test/SemaCXX/namespace-alias.cpp
parent0315920629da8a51b717cbaff05dcd2af42ea5d5 (diff)
downloadbcm5719-llvm-f2005d3de64f9230c6b43b4f4da1866d999446c8.tar.gz
bcm5719-llvm-f2005d3de64f9230c6b43b4f4da1866d999446c8.zip
Model NamespaceAliasDecls as having their nominated namespace as an underlying
declaration. This fixes an issue where we would reject (due to a claimed ambiguity) a case where lookup finds multiple NamespaceAliasDecls from different scopes that nominate the same namespace. The C++ standard doesn't make it clear that such a case is in fact valid (which I'm working on fixing), but there are no relevant rules that distinguish using declarations and namespace alias declarations here, so it makes sense to treat them the same way. llvm-svn: 256601
Diffstat (limited to 'clang/test/SemaCXX/namespace-alias.cpp')
-rw-r--r--clang/test/SemaCXX/namespace-alias.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/namespace-alias.cpp b/clang/test/SemaCXX/namespace-alias.cpp
index 1cf820e3e38..2ba771ed018 100644
--- a/clang/test/SemaCXX/namespace-alias.cpp
+++ b/clang/test/SemaCXX/namespace-alias.cpp
@@ -133,3 +133,27 @@ namespace PR25731 {
X::f();
}
}
+
+namespace MultipleUnambiguousLookupResults {
+ namespace A { int y; }
+ namespace B {
+ namespace X { int x; }
+ namespace Y = A;
+ namespace Z = A; // expected-note {{candidate}}
+ }
+ namespace C {
+ namespace X = B::X;
+ namespace Y = A;
+ namespace Z = X; // expected-note {{candidate}}
+ }
+ using namespace B;
+ using namespace C;
+ int x1 = X::x; // ok, unambiguous
+ int y1 = Y::y; // ok, unambiguous
+ int z1 = Z::x; // expected-error {{ambiguous}}
+
+ namespace X = C::X;
+ namespace Y = A;
+ int x2 = X::x; // ok, unambiguous
+ int y2 = Y::y; // ok, unambiguous
+}
OpenPOWER on IntegriCloud