https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101182
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:0f00006c007f3f7e9b6fdd9906ed1e4c791f6b15 commit r11-8729-g0f00006c007f3f7e9b6fdd9906ed1e4c791f6b15 Author: Patrick Palka <ppa...@redhat.com> Date: Thu Jun 24 11:29:02 2021 -0400 c++: requires-expression folding [PR101182] Here we're crashing because cp_fold_function walks into the (templated) requirements of a requires-expression outside a template, but the folding routines aren't prepared to handle templated trees. This patch fixes this by making cp_fold use evaluate_requires_expr to fold a requires-expression as a whole, which also means we no longer need to explicitly do so during gimplification. (Note that we delay folding of such requires-expressions for sake of better diagnostics when one is used as the condition of a failed static_assert.) PR c++/101182 gcc/cp/ChangeLog: * constraint.cc (evaluate_requires_expr): Adjust function comment. * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: Move to ... (cp_fold) <case REQUIRES_EXPR>: ... here. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-requires25.C: New test. (cherry picked from commit c06493dc30afbf65b14d783c7cd53f20877ef577)