]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Apply/diagnose attributes when instatiating ARRAY/POINTER/REFERENCE_TYPE [PR118787]
authorJakub Jelinek <jakub@redhat.com>
Wed, 5 Mar 2025 05:41:00 +0000 (06:41 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 5 Mar 2025 05:41:00 +0000 (06:41 +0100)
commit1853b02d8c127740055242123db2d32cf9476ea9
tree48f01be5ef7ec54f6da846d1ea1afa2c915a9091
parent4856292f7a680ec478e7607f1b71781996d7d542
c++: Apply/diagnose attributes when instatiating ARRAY/POINTER/REFERENCE_TYPE [PR118787]

The following testcase IMO in violation of the P2552R3 paper doesn't
pedwarn on alignas applying to dependent types or alignas with dependent
argument.

tsubst was just ignoring TYPE_ATTRIBUTES.

The following patch fixes it for the POINTER/REFERENCE_TYPE and
ARRAY_TYPE cases, but perhaps we need to do the same also for other
types (INTEGER_TYPE/REAL_TYPE and the like).  I guess I'll need to
construct more testcases.

2025-03-05  Jakub Jelinek  <jakub@redhat.com>

PR c++/118787
* pt.cc (tsubst) <case ARRAY_TYPE>: Use return t; only if it doesn't
have any TYPE_ATTRIBUTES.  Call apply_late_template_attributes.
<case POINTER_TYPE, case REFERENCE_TYPE>: Likewise.  Formatting fix.

* g++.dg/cpp0x/alignas22.C: New test.
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp0x/alignas22.C [new file with mode: 0644]