Make sure to properly track the anonymous namespace that lives inside
each namespace, even when the outer namespace has multiple
definitions. As part of this, collapsed two pointers worth of storage
(original namespace and inner anonymous namespace) into a single
pointer with a distinguishing bit, since the two are mutually
exclusive, saving a pointer per NamespaceDecl. Fixes PR6620.
llvm-svn: 99368
diff --git a/clang/test/SemaCXX/namespace.cpp b/clang/test/SemaCXX/namespace.cpp
index 2a9d31f..d47b707 100644
--- a/clang/test/SemaCXX/namespace.cpp
+++ b/clang/test/SemaCXX/namespace.cpp
@@ -68,3 +68,25 @@
static foo::x test1; // ok
static foo::X test2; // typo: expected-error {{no type named 'X' in}}
+
+namespace PR6620 {
+ namespace numeric {
+ namespace op {
+ struct greater {};
+ }
+ namespace {
+ extern op::greater const greater;
+ }
+ }
+
+ namespace numeric {
+ namespace {
+ op::greater const greater = op::greater();
+ }
+
+ template<typename T, typename U>
+ int f(T& l, U& r)
+ { numeric::greater(l, r); }
+
+ }
+}