diff options
| author | Nathaniel Shead <nathanieloshead@gmail.com> | 2025-11-02 15:58:39 +1100 |
|---|---|---|
| committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2025-11-06 10:19:37 +1100 |
| commit | f5db79b06eb85f715dc3180065cb326ed180ab23 (patch) | |
| tree | 7fc62364b7265b3cd0e45e2deade4a4b23134bf2 /libgrust/rustc-lib/stdarch/crates/std_detect | |
| parent | 99c2ed7407154164c25b4f12e82af77c67cde3a3 (diff) | |
| download | gcc-f5db79b06eb85f715dc3180065cb326ed180ab23.zip gcc-f5db79b06eb85f715dc3180065cb326ed180ab23.tar.gz gcc-f5db79b06eb85f715dc3180065cb326ed180ab23.tar.bz2 | |
c++/modules: Complain on imported GMF TU-local entities in instantiation [PR121574]
An unfortunate side effect of the previous patch is that even with
-pedantic-errors, unless the user specifies -Wtemplate-names-tu-local
when building the module interface there will be no diagnostic at all
from instantiating a template that exposes global TU-local entities,
either when building the module or its importer.
This patch solves this by recognising imported TU-local dependencies,
even if they weren't streamed as TU_LOCAL_ENTITY nodes. The warnings
here are deliberately conservative for when we can be sure this was
actually an imported TU-local entity; in particular, we bail on any
TU-local entity that originated from a header module, without attempting
to determine if the entity came via a named module first.
PR c++/121574
gcc/cp/ChangeLog:
* cp-tree.h (instantiating_tu_local_entity): Declare.
* module.cc (is_tu_local_entity): Extract from depset::hash.
(is_tu_local_value): Likewise.
(has_tu_local_tmpl_arg): Likewise.
(depset::hash::is_tu_local_entity): Remove.
(depset::hash::has_tu_local_tmpl_arg): Remove.
(depset::hash::is_tu_local_value): Remove.
(instantiating_tu_local_entity): New function.
(depset::hash::add_binding_entity): No longer go through
depset::hash to check is_tu_local_entity.
* pt.cc (complain_about_tu_local_entity): Remove.
(tsubst): Use instantiating_tu_local_entity.
(tsubst_expr): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/modules/internal-17_b.C: Check for diagnostics when
instantiating imported TU-local entities.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'libgrust/rustc-lib/stdarch/crates/std_detect')
0 files changed, 0 insertions, 0 deletions
