https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109300
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-03-27 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Keywords|ice-on-valid-code |ice-on-invalid-code, | |needs-bisection --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note I think this is invalid code. With an instantation, GCC 12 (and before) does reject it: ``` template<typename T> auto x = [](){ x<int>(); }; auto y = x<int>; ``` ``` <source>: In instantiation of 'auto x<int>': <source>:3:10: required from here <source>:2:16: error: use of 'x<int>' before deduction of 'auto' 2 | auto x = [](){ x<int>(); }; | ^~~~~~ <source>:2:6: error: 'x<int>' has incomplete type 2 | auto x = [](){ x<int>(); }; | ^ <source>:2:22: error: invalid use of 'auto' 2 | auto x = [](){ x<int>(); }; | ~~~~~~^~ ``` Note clang rejects it even without an instantation.