]> gcc.gnu.org Git - gcc.git/commitdiff
[PR c++/71251] check tmpl parms in template using decl
authorAlexandre Oliva <aoliva@redhat.com>
Fri, 23 Mar 2018 04:09:06 +0000 (04:09 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Fri, 23 Mar 2018 04:09:06 +0000 (04:09 +0000)
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
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr71251.C [new file with mode: 0644]

index 08ecf21d9ba18015c5b2a9f829dda83995bc3d66..cdbbd4193408ece03a15720d1b8177a6d1401554 100644 (file)
@@ -1,4 +1,8 @@
-2018-03-22  Alexandre Oliva <aoliva@redhat.com>
+2018-03-23  Alexandre Oliva <aoliva@redhat.com>
+
+       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
index fd817024eacfc2b3db58df6eff18e7300955dea7..602cc991ff6ed4574f6d100e0e69370522c25f62 100644 (file)
@@ -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;
 
index 4875ce45e8d144a4f9e13fca97e91ef638a8a013..560e6d38b840b32c3d5d3e8f8234cabdff2286e2 100644 (file)
@@ -1,4 +1,7 @@
-2018-03-22  Alexandre Oliva <aoliva@redhat.com>
+2018-03-23  Alexandre Oliva <aoliva@redhat.com>
+
+       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 (file)
index 0000000..3df831b
--- /dev/null
@@ -0,0 +1,15 @@
+// { dg-do compile { target c++11 } }
+
+template<int,int> template<typename>
+using U = void; // { dg-error "too many" }
+
+template<typename>
+using V = void;
+
+template<typename> struct X {
+  template<typename> template<typename>
+  using U = void; // { dg-error "too many" }
+
+  template<typename>
+  using V = void;
+};
This page took 0.125961 seconds and 5 git commands to generate.