From 631270a5cedfad8267a5e7b94901035212713b61 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Fri, 23 Mar 2018 04:09:06 +0000 Subject: [PATCH] [PR c++/71251] check tmpl parms in template using decl Check that template using decls have the correct number of parm lists. 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. From-SVN: r258793 --- gcc/cp/ChangeLog | 6 +++++- gcc/cp/parser.c | 7 +++++++ gcc/testsuite/ChangeLog | 5 ++++- gcc/testsuite/g++.dg/cpp0x/pr71251.C | 15 +++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr71251.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 08ecf21d9ba..cdbbd419340 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,4 +1,8 @@ -2018-03-22 Alexandre Oliva +2018-03-23 Alexandre Oliva + + PR c++/71251 + * parser.c (cp_parser_alias_declaration): Call + parser_check_template_parameters. PR c++/84789 * pt.c (resolve_typename_type): Drop assert that stopped diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index fd817024eac..602cc991ff6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -18965,6 +18965,13 @@ cp_parser_alias_declaration (cp_parser* parser) ds_alias, using_token); + if (parser->num_template_parameter_lists + && !cp_parser_check_template_parameters (parser, + /*num_templates=*/0, + id_location, + /*declarator=*/NULL)) + return error_mark_node; + declarator = make_id_declarator (NULL_TREE, id, sfk_none); declarator->id_loc = id_location; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4875ce45e8d..560e6d38b84 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,7 @@ -2018-03-22 Alexandre Oliva +2018-03-23 Alexandre Oliva + + PR c++/71251 + * g++.dg/cpp0x/pr71251.C: New. PR c++/84789 * g++.dg/template/pr84789.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71251.C b/gcc/testsuite/g++.dg/cpp0x/pr71251.C new file mode 100644 index 00000000000..3df831bb581 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr71251.C @@ -0,0 +1,15 @@ +// { dg-do compile { target c++11 } } + +template template +using U = void; // { dg-error "too many" } + +template +using V = void; + +template struct X { + template template + using U = void; // { dg-error "too many" } + + template + using V = void; +}; -- 2.30.2