When setting the anonymous namespace at PCH reading, it may still be initializing so avoid
the invariant checks at NamespaceDecl::setAnonymousNamespace().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107566 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/PCH/cxx-namespaces.cpp b/test/PCH/cxx-namespaces.cpp
new file mode 100644
index 0000000..0fd3de7
--- /dev/null
+++ b/test/PCH/cxx-namespaces.cpp
@@ -0,0 +1,10 @@
+// Test this without pch.
+// RUN: %clang_cc1 -include %S/cxx-namespaces.h -fsyntax-only -verify %s
+
+// Test with pch.
+// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-namespaces.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
+
+void m() {
+ N::x = 0;
+}
diff --git a/test/PCH/cxx-namespaces.h b/test/PCH/cxx-namespaces.h
new file mode 100644
index 0000000..f338953
--- /dev/null
+++ b/test/PCH/cxx-namespaces.h
@@ -0,0 +1,7 @@
+// Header for PCH test cxx-namespaces.cpp
+
+namespace N {
+ namespace {
+ int x;
+ }
+}