re PR c++/60187 ([c++11] ICE with parameter pack as underlying type for enum)
authorJason Merrill <jason@redhat.com>
Fri, 21 Feb 2014 21:47:30 +0000 (16:47 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 21 Feb 2014 21:47:30 +0000 (16:47 -0500)
PR c++/60187
* parser.c (cp_parser_enum_specifier): Call
check_for_bare_parameter_packs.

From-SVN: r208026

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp0x/enum_base2.C [new file with mode: 0644]

index 1fcf54d..14d4995 100644 (file)
@@ -1,5 +1,9 @@
 2014-02-21  Jason Merrill  <jason@redhat.com>
 
+       PR c++/60187
+       * parser.c (cp_parser_enum_specifier): Call
+       check_for_bare_parameter_packs.
+
        PR c++/59347
        * pt.c (tsubst_decl) [TYPE_DECL]: Don't try to instantiate an
        erroneous typedef.
index 6f19ae2..7bbdf90 100644 (file)
@@ -15376,7 +15376,8 @@ cp_parser_enum_specifier (cp_parser* parser)
         {
           underlying_type = grokdeclarator (NULL, &type_specifiers, TYPENAME,
                                             /*initialized=*/0, NULL);
-          if (underlying_type == error_mark_node)
+          if (underlying_type == error_mark_node
+             || check_for_bare_parameter_packs (underlying_type))
             underlying_type = NULL_TREE;
         }
     }
diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base2.C b/gcc/testsuite/g++.dg/cpp0x/enum_base2.C
new file mode 100644 (file)
index 0000000..8c6a901
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/60187
+// { dg-require-effective-target c++11 }
+
+template<typename... T> struct A
+{
+  enum E : T {};               // { dg-error "parameter pack" }
+};
+
+A<int> a;