diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-06-03 09:17:31 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-06-03 09:17:31 -0400 |
commit | 557cc2b721432775a12fcafa60e9b8b0c320c29d (patch) | |
tree | 33493ec11a20985b1115833844360b8b9cafb8b7 /libgcc | |
parent | 999e617d3121b82921c8031ee695fd036f553f04 (diff) | |
download | gcc-557cc2b721432775a12fcafa60e9b8b0c320c29d.zip gcc-557cc2b721432775a12fcafa60e9b8b0c320c29d.tar.gz gcc-557cc2b721432775a12fcafa60e9b8b0c320c29d.tar.bz2 |
c++: replace in_template_function
All uses of in_template_function except for the one in cp_make_fname_decl
seem like they could be generalized to consider any template context.
To that end this patch replaces the predicate with a generalized
in_template_context predicate that returns true if we're inside any
template context. If we legitimately need to consider only function
contexts, as in cp_make_fname_decl, we can just additionally check e.g.
current_function_decl.
One concrete benefit of this, which the adjusted testcase below
demonstrates, is that we no longer instantiate/odr-use entities based on
uses within a non-function template.
gcc/cp/ChangeLog:
* class.cc (build_base_path): Check in_template_context instead
of in_template_function.
(resolves_to_fixed_type_p): Likewise.
* cp-tree.h (in_template_context): Define.
(in_template_function): Remove.
* decl.cc (cp_make_fname_decl): Check current_function_decl
and in_template_context instead of in_template_function.
* decl2.cc (mark_used): Check in_template_context instead of
in_template_function.
* pt.cc (in_template_function): Remove.
* semantics.cc (enforce_access): Check in_template_context
instead of current_template_parms directly.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Waddress-of-packed-member2.C: No longer expect a()
to be marked as odr-used.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions