]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix up handling of dependent (late) attributes on function/method types [PR116175]
authorJakub Jelinek <jakub@redhat.com>
Wed, 7 Aug 2024 07:48:07 +0000 (09:48 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 7 Aug 2024 07:48:07 +0000 (09:48 +0200)
commit9426ce98ccb35a43b4f3e8ea14dcbf2f5de5dc48
treed9d1e5a24a7277c697c33b88bb613fa43baf7933
parent2cf89ae83225f932b226cd57ef2d083a59bcf8a3
c++: Fix up handling of dependent (late) attributes on function/method types [PR116175]

When working on unsequenced/reproducible attributes, I've noticed that on
templates for some attributes decl_attributes isn't called at all, so they
are kept in TYPE_ATTRIBUTES without any verification/transformations and
also without argument substitution.

The following patch fixes that for FUNCTION/METHOD_TYPE attributes.
The included testcase ICEs without the pt.cc changes.

2024-08-07  Jakub Jelinek  <jakub@redhat.com>

PR c++/116175
* pt.cc (apply_late_template_attributes): For function/method types
call cp_build_type_attribute_variant on the non-dependent attributes.
(rebuild_function_or_method_type): Add ARGS argument.  Use
apply_late_template_attributes rather than
cp_build_type_attribute_variant.
(maybe_rebuild_function_decl_type): Add ARGS argument, pass it to
rebuild_function_or_method_type.
(tsubst_function_decl): Adjust caller.
(tsubst_function_type): Adjust rebuild_function_or_method_type caller.

* g++.dg/ext/attr-format4.C: New test.
gcc/cp/pt.cc
gcc/testsuite/g++.dg/ext/attr-format4.C [new file with mode: 0644]