[Bug c++/95020] requires expression always evaluates to true in the definition of template lambda defined within template function
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 2 12:52:45 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95020
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:0971201a1e5e1e5df7de666ea1c4b2605a51cc76
commit r10-8222-g0971201a1e5e1e5df7de666ea1c4b2605a51cc76
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Jun 2 08:52:21 2020 -0400
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.cc (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++.dg/cpp2a/concepts-lambda7.C: New test.
(cherry picked from commit 7e52f8b1e03776575b92574252d9b6bbed9f1af4)
More information about the Gcc-bugs
mailing list