8sa1-gcc/gcc/cp
Patrick Palka b28b621ac6 c++: requires-expressions and partial instantiation [PR96410]
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.
2020-09-17 09:16:02 -04:00
..
call.c c++: DECL_LOCAL_FUNCTION_P -> DECL_LOCAL_DECL_P 2020-09-10 05:45:46 -07:00
cfns.gperf
cfns.h
ChangeLog Daily bump. 2020-09-17 00:16:31 +00:00
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 c++: Fix resolving the address of overloaded pmf [PR96647] 2020-09-09 09:21:09 -04:00
config-lang.in
constexpr.c c++: Fix another PCH hash_map issue [PR96901] 2020-09-03 21:53:40 +02:00
constraint.cc c++: requires-expressions and partial instantiation [PR96410] 2020-09-17 09:16:02 -04:00
coroutines.cc
cp-gimplify.c OpenMP/Fortran: Fix (re)mapping of allocatable/pointer arrays [PR96668] 2020-09-15 09:24:47 +02:00
cp-lang.c
cp-name-hint.h
cp-objcp-common.c
cp-objcp-common.h
cp-tree.def c++: requires-expressions and partial instantiation [PR96410] 2020-09-17 09:16:02 -04:00
cp-tree.h c++: requires-expressions and partial instantiation [PR96410] 2020-09-17 09:16:02 -04:00
cp-ubsan.c
cvt.c
cxx-pretty-print.c
cxx-pretty-print.h
decl2.c c++: Remove LOOKUP_CONSTINIT. 2020-09-11 11:17:03 -04:00
decl.c c++: Concepts and local externs 2020-09-11 13:55:45 -07:00
decl.h
dump.c
error.c
except.c
expr.c c++: Use iloc_sentinel in mark_use. 2020-09-04 13:56:32 -04:00
friend.c
g++spec.c
init.c c++: Further tweaks for new-expression and paren-init [PR77841] 2020-09-09 17:46:04 -04:00
lambda.c
lang-specs.h
lex.c
logic.cc
Make-lang.in
mangle.c
method.c
name-lookup.c c++: DECL_LOCAL_FUNCTION_P -> DECL_LOCAL_DECL_P 2020-09-10 05:45:46 -07:00
name-lookup.h
operators.def
optimize.c c++: Emit as-base 'tor symbols for final class. [PR95428] 2020-08-24 22:43:39 -04:00
parser.c objc++: Always pop scope with method definitions [PR97015] 2020-09-11 08:27:40 -07:00
parser.h
pt.c c++: local-scope OMP UDR reductions have no template head 2020-09-16 12:16:11 -07:00
ptree.c c++: overload dumper 2020-08-24 06:28:37 -07:00
rtti.c vec: add exact argument for various grow functions. 2020-08-27 13:29:43 +02:00
search.c
semantics.c c++: local-scope OMP UDR reductions have no template head 2020-09-16 12:16:11 -07:00
tree.c
type-utils.h
typeck2.c c++: Remove LOOKUP_CONSTINIT. 2020-09-11 11:17:03 -04:00
typeck.c
vtable-class-hierarchy.c