]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Stream all REQUIRES_EXPR_PARMS [PR122789]
authorNathaniel Shead <nathanieloshead@gmail.com>
Sun, 23 Nov 2025 12:24:39 +0000 (23:24 +1100)
committerNathaniel Shead <nathanieloshead@gmail.com>
Tue, 25 Nov 2025 11:37:27 +0000 (22:37 +1100)
commit53b4e1d951eaf5bbb2fcedfdd156d80a4160878a
treed9979f6ac66478f9ba926c970a37ac9999a7653b
parent3ad2e2d707c3d6b0c6bd8c3ef0df4f7aaee1c3c2
c++/modules: Stream all REQUIRES_EXPR_PARMS [PR122789]

We don't generally stream the TREE_CHAIN of a DECL, as this would cause
us to unnecessarily walk into the next member in its scope chain any
time it was referenced by an expression.

Unfortunately, REQUIRES_EXPR_PARMS is a tree chain of PARM_DECLs, so we
were only ever streaming the first parameter.  This meant that when a
parameter's type could not be tsubst'd we would ICE instead of returning
false.

This patch special-cases REQUIRES_EXPR to always stream the chain of
decls in its first operand.  As a drive-by improvement we also remove a
fixme about checking uncontexted PARM_DECLs.

PR c++/122789

gcc/cp/ChangeLog:

* module.cc (trees_out::core_vals): Treat REQUIRES_EXPR
specially and stream the chained decls of its first operand.
(trees_in::core_vals): Likewise.
(trees_out::tree_node): Check the PARM_DECLs we see are what we
expect.

gcc/testsuite/ChangeLog:

* g++.dg/modules/concept-12_a.C: New test.
* g++.dg/modules/concept-12_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/concept-12_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/concept-12_b.C [new file with mode: 0644]