On Tue, Mar 20, 2018 at 6:51 PM, Alexandre Oliva <aol...@redhat.com> wrote: > On Mar 20, 2018, Jason Merrill <ja...@redhat.com> wrote: > >> On Tue, Mar 20, 2018 at 4:15 PM, Alexandre Oliva <aol...@redhat.com> wrote: >>> Should we aim at rejecting the declaration of U? > >> Yes. > > Like this? > > [PR c++/71251] check tmpl parms in template using decl > > Check that template using decls have the correct number of parm lists. > > Will regstrap shortly, ok to install if it passes? > > for gcc/cp/ChangeLog > > PR c++/71251 > * parser.c (cp_parser_alias_declaration): Call > parser_check_template_parameters. > > for gcc/testsuite/ChangeLog > > PR c++/71251 > * g++.dg/cpp0x/pr71251.C: New. > --- > gcc/cp/parser.c | 10 ++++++++++ > gcc/testsuite/g++.dg/cpp0x/pr71251.C | 15 +++++++++++++++ > 2 files changed, 25 insertions(+) > create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr71251.C > > diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c > index ce05615adfba..8fa6a37c82f0 100644 > --- a/gcc/cp/parser.c > +++ b/gcc/cp/parser.c > @@ -18910,6 +18910,13 @@ cp_parser_alias_declaration (cp_parser* parser) > if (id == error_mark_node) > return error_mark_node; > > + if (parser->num_template_parameter_lists > + && !cp_parser_check_template_parameters (parser, > + /*num_templates=*/0, > + id_location, > + /*declarator=*/NULL)) > + id = error_mark_node; > cp_token *attrs_token = cp_lexer_peek_token (parser->lexer); > attributes = cp_parser_attributes_opt (parser); > if (attributes == error_mark_node) > @@ -18980,6 +18987,9 @@ cp_parser_alias_declaration (cp_parser* parser) > ds_alias, > using_token); > > + if (id == error_mark_node) > + return error_mark_node;
Why wait until here to return? There are error returns immediately above and below your first hunk. Jason