c++: diagnose auto in template arg
commitd3e2a174b13dd06e63abdb89f3b3040731a73aff
authorJason Merrill <jason@redhat.com>
Thu, 8 Jun 2023 23:31:18 +0000 (8 19:31 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 9 Jun 2023 15:41:42 +0000 (9 11:41 -0400)
tree26d2d517580b4e4ebc7a753303d579ed7a66628b
parent35d2c40e4ac9ba57ae82e4722e557a2028d0cf13
c++: diagnose auto in template arg

We were failing to diagnose this Concepts TS feature that didn't make it
into C++20 because the 'auto' was getting converted to a template parameter
before we checked for it.  So also check in cp_parser_simple_type_specifier.

The code in cp_parser_template_type_arg that I initially expected to
diagnose this seems unreachable because cp_parser_type_id_1 already checks
auto.

gcc/cp/ChangeLog:

* parser.cc (cp_parser_simple_type_specifier): Check for auto
in template argument.
(cp_parser_template_type_arg): Remove auto checking.

gcc/testsuite/ChangeLog:

* g++.dg/concepts/auto7.C: New test.
* g++.dg/concepts/auto7a.C: New test.
gcc/cp/parser.cc
gcc/testsuite/g++.dg/concepts/auto7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/concepts/auto7a.C [new file with mode: 0644]