]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: constraint variable used in evaluated context [PR117849]
authorPatrick Palka <ppalka@redhat.com>
Fri, 4 Apr 2025 18:03:58 +0000 (14:03 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 4 Apr 2025 18:30:34 +0000 (14:30 -0400)
commit49b6308d2596f7334011f84bae8d35d68c302a3c
tree902b55a1f13c685aed6abec7a1ad9f60c12977b6
parent9a747094ac623bfd5c5d90eecf2d920f231de1c0
c++: constraint variable used in evaluated context [PR117849]

Here we wrongly reject the type-requirement at parse time due to its use
of the constraint variable 't' within a template argument (an evaluated
context).  Fix this simply by refining the "use of parameter outside
function body" error path to exclude constraint variables.

PR c++/104255 tracks the same issue for function parameters, but fixing
that would be more involved, requiring changes to the PARM_DECL case of
tsubst_expr.

PR c++/117849

gcc/cp/ChangeLog:

* semantics.cc (finish_id_expression_1): Allow use of constraint
variable outside an unevaluated context.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-requires41.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 6e973e87e3fec6f33e97edf8fce2fcd121e53961)
gcc/cp/semantics.cc
gcc/testsuite/g++.dg/cpp2a/concepts-requires41.C [new file with mode: 0644]