[Bug c++/105921] internal compiler error: in cp_parser_template_id, at cp/parser.cc:18362

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 21 02:55:47 GMT 2022


Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
      Known to fail|                            |11.1.0, 6.1.0, 9.1.0
           Keywords|ice-on-valid-code           |

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
template <int T>
auto a = (struct A {}){};

int main () {

So GCC declares this as a compound literal where the new type is defined in the
(). It turns out for template variables, GCC is not ready for this.

Note clang rejects this code in both the non-template case and the template
case where defining a new struct is not allowed.

I don't know if we should restrict defining the new struct here or not.

This is not a regression either.

More information about the Gcc-bugs mailing list