When we push an existing namespace within the module purview for the
first time, we also need to mark any parent inline namespaces as purview
to not confuse the streaming logic.
PR c++/121724
gcc/cp/ChangeLog:
* name-lookup.cc (push_namespace): Mark inline namespace
contexts as purview if needed.
gcc/testsuite/ChangeLog:
* g++.dg/modules/namespace-12_a.C: New test.
* g++.dg/modules/namespace-12_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
gcc_checking_assert (!(tree)slot || (tree)slot == ctx);
slot = ctx;
}
+
+ if (module_purview_p ())
+ DECL_MODULE_PURVIEW_P (ctx) = true;
}
}
--- /dev/null
+// PR c++/121724
+// { dg-additional-options "-fmodules -Wno-global-module" }
+// { dg-module-cmi foo }
+
+module;
+namespace A {
+ inline namespace X {
+ namespace B {
+ }
+ }
+}
+export module foo;
+export namespace A {
+ namespace B {
+ struct S {};
+ }
+}
--- /dev/null
+// PR c++/121724
+// { dg-additional-options "-fmodules" }
+
+import foo;
+using T = A::B::S;
+using T = A::X::B::S;