]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/39637 (ICE on ill-formed sizeof(<parameter-pack>) in variadic template)
authorDodji Seketeli <dodji@redhat.com>
Wed, 8 Apr 2009 08:59:02 +0000 (08:59 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Wed, 8 Apr 2009 08:59:02 +0000 (10:59 +0200)
gcc/cp/ChangeLog:
2009-04-08  Dodji Seketeli  <dodji@redhat.com>
    PR c++/39637
    * parser.c (cp_parser_enumerator_definition): Make sure the
    initializer of the enumerator doesn't contain any bare parameter pack.

gcc/testsuite/ChangeLog
2009-04-08  Dodji Seketeli  <dodji@redhat.com>
    PR c++/39637
    * g++.dg/cpp0x/variadic-crash2.C: New test.

From-SVN: r145713

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

index 4905a601d38f706dd06dc1f42511d9caebbc3863..64c0d09e796f9ec607cef2f73474f2dbc077f6fd 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-08  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/39637
+       * parser.c (cp_parser_enumerator_definition): Make sure the
+       initializer of the enumerator doesn't contain any bare parameter pack.
+
 2009-04-06  Jason Merrill  <jason@redhat.com>
 
        PR c++/35146
index 9393ba436eb9a140092d8c7298b22ec1061a825b..d22cee6f12b6e4073f9ef13cb805a45f6d471ff4 100644 (file)
@@ -11491,6 +11491,11 @@ cp_parser_enumerator_definition (cp_parser* parser, tree type)
   else
     value = NULL_TREE;
 
+  /* If we are processing a template, make sure the initializer of the
+     enumerator doesn't contain any bare template parameter pack.  */
+  if (check_for_bare_parameter_packs (value))
+    value = error_mark_node;
+
   /* Create the enumerator.  */
   build_enumerator (identifier, value, type);
 }
index 8e70ccf9765843f229aa41f1401f570b419e93bf..e4737e5fc805d7a1fd0154db50dd4386c3db6c24 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-08  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/39637
+       * g++.dg/cpp0x/variadic-crash2.C: New test.
+
 2009-04-06  Jason Merrill  <jason@redhat.com>
 
        PR c++/35146
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-crash2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-crash2.C
new file mode 100644 (file)
index 0000000..7250eff
--- /dev/null
@@ -0,0 +1,18 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin: PR c++/39637
+// { dg-options "-std=gnu++0x" }
+// { dg-do "compile" }
+
+template<class... Types>
+void
+f(Types...)
+{
+  enum {e = sizeof(Types)}; // { dg-error "parameter packs not expanded with|note" }
+  enum {e1 = sizeof...(Types)};
+}
+
+int
+main()
+{
+    f(0);
+}