]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: build_extra_args recapturing local specs [PR114303]
authorPatrick Palka <ppalka@redhat.com>
Thu, 11 Apr 2024 14:16:41 +0000 (10:16 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 11 Apr 2024 14:16:41 +0000 (10:16 -0400)
commitb262b17636e47ae969a74f16e86ccb00678d5e88
tree6660e5747b02dd730bef976d19b3eb1a509c71ef
parent0dc39dee836761f1bc993d760f4ed5f3d127897a
c++: build_extra_args recapturing local specs [PR114303]

r13-6452-g341e6cd8d603a3 made build_extra_args walk evaluated contexts
first so that we prefer processing a local specialization in an evaluated
context even if its first use is in an unevaluated context.  But this
means we need to avoid walking a tree that already has extra args/specs
saved because the list of saved specs appears to be an evaluated
context which we'll now walk first.  It seems then that we should be
calculating the saved specs from scratch each time, rather than
potentially walking the saved specs list from an earlier partial
instantiation when calling build_extra_args a second time around.

PR c++/114303

gcc/cp/ChangeLog:

* constraint.cc (tsubst_requires_expr): Clear
REQUIRES_EXPR_EXTRA_ARGS before calling build_extra_args.
* pt.cc (tree_extra_args): Define.
(extract_locals_r): Assert *_EXTRA_ARGS is empty.
(tsubst_stmt) <case IF_STMT>: Clear IF_SCOPE on the new
IF_STMT.  Call build_extra_args on the new IF_STMT instead
of t which might already have IF_STMT_EXTRA_ARGS.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/constexpr-if-lambda6.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/constraint.cc
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda6.C [new file with mode: 0644]