b28b621ac6
This patch makes tsubst_requires_expr avoid substituting into a requires-expression when partially instantiating a generic lambda. This is necessary in general to ensure that we always check requirements in lexical order (as in the first testcase below). A mechanism similar to PACK_EXPANSION_EXTRA_ARGS is added to remember template arguments and defer substitution of requires-expressions. Incidentally, this change also fixes the two mentioned PRs -- the problem there is that tsubst_requires_expr was performing semantic checks on template trees, and some of the checks are not prepared to handle such trees. With this patch, tsubst_requires_expr no longer does any semantic checking at all when processing_template_decl. gcc/cp/ChangeLog: PR c++/96409 PR c++/96410 * constraint.cc (tsubst_requires_expr): Use REQUIRES_EXPR_PARMS and REQUIRES_EXPR_REQS. Use REQUIRES_EXPR_EXTRA_ARGS, add_extra_args and build_extra_args to defer substitution until we have all the template arguments. (finish_requires_expr): Adjust the call to build_min so that REQUIRES_EXPR_EXTRA_ARGS gets set to NULL_TREE. * cp-tree.def (REQUIRES_EXPR): Give it a third operand. * cp-tree.h (REQUIRES_EXPR_PARMS, REQUIRES_EXPR_REQS, REQUIRES_EXPR_EXTRA_ARGS): Define. (add_extra_args, build_extra_args): Declare. gcc/testsuite/ChangeLog: PR c++/96409 PR c++/96410 * g++.dg/cpp2a/concepts-lambda13.C: New test. * g++.dg/cpp2a/concepts-lambda14.C: New test. |
||
---|---|---|
.. | ||
call.c | ||
cfns.gperf | ||
cfns.h | ||
ChangeLog | ||
ChangeLog-1993 | ||
ChangeLog-1994 | ||
ChangeLog-1995 | ||
ChangeLog-1996 | ||
ChangeLog-1997 | ||
ChangeLog-1998 | ||
ChangeLog-1999 | ||
ChangeLog-2000 | ||
ChangeLog-2001 | ||
ChangeLog-2002 | ||
ChangeLog-2003 | ||
ChangeLog-2004 | ||
ChangeLog-2005 | ||
ChangeLog-2006 | ||
ChangeLog-2007 | ||
ChangeLog-2008 | ||
ChangeLog-2009 | ||
ChangeLog-2010 | ||
ChangeLog-2011 | ||
ChangeLog-2012 | ||
ChangeLog-2013 | ||
ChangeLog-2014 | ||
ChangeLog-2015 | ||
ChangeLog-2016 | ||
ChangeLog-2017 | ||
ChangeLog-2018 | ||
ChangeLog-2019 | ||
ChangeLog.ptr | ||
ChangeLog.tree-ssa | ||
class.c | ||
config-lang.in | ||
constexpr.c | ||
constraint.cc | ||
coroutines.cc | ||
cp-gimplify.c | ||
cp-lang.c | ||
cp-name-hint.h | ||
cp-objcp-common.c | ||
cp-objcp-common.h | ||
cp-tree.def | ||
cp-tree.h | ||
cp-ubsan.c | ||
cvt.c | ||
cxx-pretty-print.c | ||
cxx-pretty-print.h | ||
decl2.c | ||
decl.c | ||
decl.h | ||
dump.c | ||
error.c | ||
except.c | ||
expr.c | ||
friend.c | ||
g++spec.c | ||
init.c | ||
lambda.c | ||
lang-specs.h | ||
lex.c | ||
logic.cc | ||
Make-lang.in | ||
mangle.c | ||
method.c | ||
name-lookup.c | ||
name-lookup.h | ||
operators.def | ||
optimize.c | ||
parser.c | ||
parser.h | ||
pt.c | ||
ptree.c | ||
rtti.c | ||
search.c | ||
semantics.c | ||
tree.c | ||
type-utils.h | ||
typeck2.c | ||
typeck.c | ||
vtable-class-hierarchy.c |