Jakub Jelinek 4a2d9d886e c++: Set OLD_PARM_DECL_P even in regenerate_decl_from_template [PR124306]
The following testcase ICEs, because we try to instantiate the PARM_DECLs
of foo <int> twice, once when parsing ^^foo <int> and remember in a
REFLECT_EXPR a PARM_DECL in there, later on regenerate_decl_from_template
is called and creates new set of PARM_DECLs and changes DECL_ARGUMENTS
(or something later on in that chain) to the new set.
This means when we call parameters_of on ^^foo <int> later on, they won't
compare equal to the earlier acquired ones, and when we do e.g. type_of
or other operation on the old PARM_DECL where it needs to search the
DECL_ARGUMENTS (DECL_CONTEXT (parm_decl)) list, it will ICE because it
won't find it there.

The following patch fixes it similarly to how duplicate_decls deals
with those, by setting OLD_PARM_DECL_P flag on the old PARM_DECLs, so that
before using reflections of those we search DECL_ARGUMENTS and find the
corresponding new PARM_DECL.

2026-03-03  Jakub Jelinek  <jakub@redhat.com>

	PR c++/124306
	* pt.cc (regenerate_decl_from_template): Mark the old PARM_DECLs
	replaced with tsubst_decl result with OLD_PARM_DECL_P flag.

	* g++.dg/reflect/parameters_of8.C: New test.
2026-03-03 15:44:19 +01:00
2026-03-02 09:49:03 +00:00
2026-02-16 00:16:25 +00:00
2026-02-22 00:16:27 +00:00
2026-03-02 09:49:03 +00:00
2026-02-24 00:16:30 +00:00
2026-02-24 00:16:30 +00:00
2026-02-27 00:16:38 +00:00
2026-03-02 09:49:03 +00:00
2026-03-02 09:49:03 +00:00
2026-02-27 00:16:38 +00:00
2026-02-13 00:16:32 +00:00
2026-03-02 09:49:03 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.8%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.3%