aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/module.cc
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2024-01-19 22:24:18 +1100
committerNathaniel Shead <nathanieloshead@gmail.com>2024-01-25 14:19:01 +1100
commit6ff54cc0be8dfa9d9bd5922ec65e86c9eb644711 (patch)
treeac35cf261caa39675f3b19c8b69069ba5bcc35c0 /gcc/cp/module.cc
parentb433a6f5a0617dcbb28f2462b31198f86aadecaa (diff)
downloadgcc-6ff54cc0be8dfa9d9bd5922ec65e86c9eb644711.zip
gcc-6ff54cc0be8dfa9d9bd5922ec65e86c9eb644711.tar.gz
gcc-6ff54cc0be8dfa9d9bd5922ec65e86c9eb644711.tar.bz2
c++: Handle partial specialisations in GMF [PR113405]
Currently, when exporting names from the GMF, or within header modules, for a set of constrained partial specialisations we only emit the first one. This is because the 'type_specialization' list only includes a single specialization per template+argument list; constraints are not considered here. The existing code uses a separate 'partial_specializations' list to track this instead, but currently it's only used for declarations in the module purview. This patch makes use of this list for all declarations. PR c++/113405 gcc/cp/ChangeLog: * module.cc (set_defining_module): Track partial specialisations for all declarations. gcc/testsuite/ChangeLog: * g++.dg/modules/concept-9.h: New test. * g++.dg/modules/concept-9_a.C: New test. * g++.dg/modules/concept-9_b.C: New test. * g++.dg/modules/concept-10_a.H: New test. * g++.dg/modules/concept-10_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Diffstat (limited to 'gcc/cp/module.cc')
-rw-r--r--gcc/cp/module.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 7078549..f26b226 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -18865,8 +18865,11 @@ set_defining_module (tree decl)
gcc_checking_assert (!DECL_LANG_SPECIFIC (decl)
|| !DECL_MODULE_IMPORT_P (decl));
- if (module_has_cmi_p ())
+ if (module_p ())
{
+ /* We need to track all declarations within a module, not just those
+ in the module purview, because we don't necessarily know yet if
+ this module will require a CMI while in the global fragment. */
tree ctx = DECL_CONTEXT (decl);
if (ctx
&& (TREE_CODE (ctx) == RECORD_TYPE || TREE_CODE (ctx) == UNION_TYPE)