c++: premature requires-expression folding [PR95020]
authorPatrick Palka <ppalka@redhat.com>
Wed, 13 May 2020 20:40:10 +0000 (16:40 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 13 May 2020 20:40:10 +0000 (16:40 -0400)
commit7e52f8b1e03776575b92574252d9b6bbed9f1af4
treeb1258207dbf28547680d2b1a431326ac498c56b6
parent661232da72d29f8f2385d5f588727beb74360144
c++: premature requires-expression folding [PR95020]

In the testcase below we're prematurely folding away the
requires-expression to 'true' after substituting in the function's
template arguments, but before substituting in the lambda's deduced
template arguments.

This patch removes the uses_template_parms check when deciding in
tsubst_requires_expr whether to keep around a new requires-expression.
Regardless of whether the template arguments are dependent, there still
might be more template parameters to later substitute in (as in the
below testcase) and even if not, tsubst_expr doesn't perform full
semantic processing unless !processing_template_decl, so we should still
wait until then to fold away the requires-expression.

gcc/cp/ChangeLog:

PR c++/95020
* constraint.c (tsubst_requires_expr): Produce a new
requires-expression when processing_template_decl, even if
template arguments are not dependent.

gcc/testsuite/ChangeLog:

PR c++/95020
* g++/cpp2a/concepts-lambda7.C: New test.
gcc/cp/ChangeLog
gcc/cp/constraint.cc
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/concepts-lambda7.C [new file with mode: 0644]