diff options
author | Dodji Seketeli <dodji@redhat.com> | 2009-04-08 09:39:51 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2009-04-08 11:39:51 +0200 |
commit | 02060927beb52d4a05173ee3e9b6aa631f994838 (patch) | |
tree | c4c894ea7966d75acf118ccda3d7a986916f927d /gcc | |
parent | bafc96b4a4e2bd72884217f26bcd970942231adb (diff) | |
download | gcc-02060927beb52d4a05173ee3e9b6aa631f994838.zip gcc-02060927beb52d4a05173ee3e9b6aa631f994838.tar.gz gcc-02060927beb52d4a05173ee3e9b6aa631f994838.tar.bz2 |
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: r145717
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/variadic-crash2.C | 20 |
4 files changed, 36 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 264fea4..22d1ced 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 28f47c8..18d62cc 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -12011,6 +12011,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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1e1206e..23564bd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-04-08 Dodji Seketeli <dodji@redhat.com> + + PRc++/39637 + * g++.dg/cpp0x/variadic-crash2.C: New test. + 2009-04-08 Paul Thomas <pault@gcc.gnu.org> PR fortran/38863 diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-crash2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-crash2.C new file mode 100644 index 0000000..d1913b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-crash2.C @@ -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 } |