diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-01-03 15:29:51 +1100 |
---|---|---|
committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-01-07 21:05:14 +1100 |
commit | 63b531e6f8783e8624502d890dc422379de47a9a (patch) | |
tree | 34e2eb1ca5e299ff7470ddb453c5aa06d83abd65 /gcc/cp | |
parent | 7f24446a3cf67d1346c78b4667fba74b73a23302 (diff) | |
download | gcc-63b531e6f8783e8624502d890dc422379de47a9a.zip gcc-63b531e6f8783e8624502d890dc422379de47a9a.tar.gz gcc-63b531e6f8783e8624502d890dc422379de47a9a.tar.bz2 |
c++: Export usings referring to global module fragment [PR109679]
This patch stops 'add_binding_entity' from ignoring all names in the
global module fragment, since they should still be exported if named
in an exported using-declaration.
PR c++/109679
gcc/cp/ChangeLog:
* module.cc (depset::hash::add_binding_entity): Don't skip names
in the GMF if they've been exported with a using declaration.
gcc/testsuite/ChangeLog:
* g++.dg/modules/using-11.h: New test.
* g++.dg/modules/using-11_a.C: New test.
* g++.dg/modules/using-11_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/module.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index a947616..e0759a9 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -12832,8 +12832,10 @@ depset::hash::add_binding_entity (tree decl, WMB_Flags flags, void *data_) else if (TREE_CODE (inner) == TEMPLATE_DECL) inner = DECL_TEMPLATE_RESULT (inner); - if (!DECL_LANG_SPECIFIC (inner) || !DECL_MODULE_PURVIEW_P (inner)) - /* Ignore global module fragment entities. */ + if ((!DECL_LANG_SPECIFIC (inner) || !DECL_MODULE_PURVIEW_P (inner)) + && !(flags & (WMB_Using | WMB_Export))) + /* Ignore global module fragment entities unless explicitly + exported with a using declaration. */ return false; if (VAR_OR_FUNCTION_DECL_P (inner) |