The following code will trigger ICE on gcc-9.1 ~ gcc-trunk with "-std=c++2a" mode: template <decltype ([] {})> auto f() {} int main() { f<{}>(); } (godbolt: https://godbolt.org/z/dEP5PT)
Started with r269972. Invalid, I think.
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:e1666ebd9ad31dbd8b9b933c883bdd882cfd1522 commit r11-8166-ge1666ebd9ad31dbd8b9b933c883bdd882cfd1522 Author: Jason Merrill <jason@redhat.com> Date: Tue Apr 13 22:28:32 2021 -0400 c++: lambda in non-type template parm type [PR99478] In this testcase, the non-type template parameter has the type of a lambda-expression. This makes no sense because a lambda in template context is specified to be distinct between different specializations of the template, even if the lambda is non-dependent, but here which specialization we are dealing with depends on which lambda we have, and vice versa. gcc/cp/ChangeLog: PR c++/99478 * parser.c (cp_parser_lambda_expression): Reject lambda in template parameter type. gcc/testsuite/ChangeLog: PR c++/99478 * g++.dg/cpp2a/lambda-uneval14.C: New test.
Fixed for 11 so far.
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
GCC 9 branch is being closed
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
Fixed in GCC 11.