re PR c++/39637 (ICE on ill-formed sizeof(<parameter-pack>) in variadic template)

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: r145715
This commit is contained in:
Dodji Seketeli 2009-04-08 09:06:08 +00:00 committed by Dodji Seketeli
parent a4385e634e
commit b813c95a12
4 changed files with 36 additions and 0 deletions

View 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-07 Jason Merrill <jason@redhat.com>
PR c++/34691

View File

@ -12012,6 +12012,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);
}

View 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-07 Jason Merrill <jason@redhat.com>
PR c++/34691

View File

@ -0,0 +1,20 @@
// 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 '...'" }
enum {e1 = sizeof...(Types)};
}
int
main()
{
f(0);
}
// { dg-message "note" "Types" { target *-*-* } 10 }