c++: fix namespace alias export
This affected std::views in module std. gcc/cp/ChangeLog: * name-lookup.cc (do_namespace_alias): set_originating_module after pushdecl. gcc/testsuite/ChangeLog: * g++.dg/modules/namespace-7_a.C: New test. * g++.dg/modules/namespace-7_b.C: New test.
This commit is contained in:
parent
e8ebc91615
commit
835530f4ee
3 changed files with 28 additions and 2 deletions
|
@ -6620,9 +6620,13 @@ do_namespace_alias (tree alias, tree name_space)
|
|||
DECL_EXTERNAL (alias) = 1;
|
||||
DECL_CONTEXT (alias) = FROB_CONTEXT (current_scope ());
|
||||
TREE_PUBLIC (alias) = TREE_PUBLIC (DECL_CONTEXT (alias));
|
||||
set_originating_module (alias);
|
||||
|
||||
pushdecl (alias);
|
||||
alias = pushdecl (alias);
|
||||
|
||||
if (!DECL_P (alias) || !DECL_NAMESPACE_ALIAS (alias))
|
||||
return;
|
||||
|
||||
set_originating_module (alias);
|
||||
|
||||
/* Emit debug info for namespace alias. */
|
||||
if (!building_stmt_list_p ())
|
||||
|
|
14
gcc/testsuite/g++.dg/modules/namespace-7_a.C
Normal file
14
gcc/testsuite/g++.dg/modules/namespace-7_a.C
Normal file
|
@ -0,0 +1,14 @@
|
|||
// { dg-additional-options "-fmodules -Wno-global-module" }
|
||||
|
||||
module;
|
||||
|
||||
namespace B { int i; }
|
||||
namespace C = B;
|
||||
|
||||
export module foo;
|
||||
// { dg-module-cmi foo }
|
||||
|
||||
export {
|
||||
namespace B { using B::i; }
|
||||
namespace C = B;
|
||||
}
|
8
gcc/testsuite/g++.dg/modules/namespace-7_b.C
Normal file
8
gcc/testsuite/g++.dg/modules/namespace-7_b.C
Normal file
|
@ -0,0 +1,8 @@
|
|||
// { dg-additional-options "-fmodules" }
|
||||
|
||||
import foo;
|
||||
|
||||
int main()
|
||||
{
|
||||
C::i = 42;
|
||||
}
|
Loading…
Add table
Reference in a new issue