diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2023-11-09 19:05:09 -0500 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2023-11-14 14:43:19 -0500 |
commit | 5b9ecce87e8f315e2681743d75401991cdfefa71 (patch) | |
tree | afbf1d9c7b2628bdc22dfe9a1b5338bd8dfed326 /gcc/cp | |
parent | 353f146cebbf224520de1bdfa8e43ceba868cf62 (diff) | |
download | gcc-5b9ecce87e8f315e2681743d75401991cdfefa71.zip gcc-5b9ecce87e8f315e2681743d75401991cdfefa71.tar.gz gcc-5b9ecce87e8f315e2681743d75401991cdfefa71.tar.bz2 |
c++: Fix exported using decls of templates
We need to look at DECL_TEMPLATE_RESULT to get the module attachment.
PR c++/106849
gcc/cp/ChangeLog:
* name-lookup.cc (do_nonmember_using_decl): Handle
TEMPLATE_DECLs when checking module attachment.
gcc/testsuite/ChangeLog:
* g++.dg/modules/using-9.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Signed-off-by: Nathan Sidwell <nathan@acm.org>
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/name-lookup.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index a8b9229..50aeb77 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -4846,12 +4846,16 @@ do_nonmember_using_decl (name_lookup &lookup, bool fn_scope_p, bool exporting = revealing_p && module_exporting_p (); if (exporting) { + /* Module flags for templates are on the template_result. */ + tree decl = STRIP_TEMPLATE (new_fn); + /* If the using decl is exported, the things it refers - to must also be exported (or not habve module attachment). */ - if (!DECL_MODULE_EXPORT_P (new_fn) - && (DECL_LANG_SPECIFIC (new_fn) - && DECL_MODULE_ATTACH_P (new_fn))) + to must also be exported (or not have module attachment). */ + if (!DECL_MODULE_EXPORT_P (decl) + && (DECL_LANG_SPECIFIC (decl) + && DECL_MODULE_ATTACH_P (decl))) { + auto_diagnostic_group d; error ("%q#D does not have external linkage", new_fn); inform (DECL_SOURCE_LOCATION (new_fn), "%q#D declared here", new_fn); |