From: Paolo Carlini Date: Sun, 8 Jun 2008 21:25:49 +0000 (+0000) Subject: re PR c++/35242 (ICE with invalid specialization of variadic template) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c528571847d2d2c4b6478dac883951b540b18a9c;p=gcc.git re PR c++/35242 (ICE with invalid specialization of variadic template) /cp 2008-06-08 Paolo Carlini PR c++/35242 * pt.c (maybe_process_partial_specialization): Check the tree returned by push_template_decl for error_mark_node. * parser.c (cp_parser_class_head): Likewise, check the tree returned by the latter. /testsuite 2008-06-08 Paolo Carlini PR c++/35242 * g++.dg/cpp0x/vt-35242.C: New. From-SVN: r136569 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fb79f4770c5..74ae4ae4d98 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2008-06-08 Paolo Carlini + + PR c++/35242 + * pt.c (maybe_process_partial_specialization): Check the tree + returned by push_template_decl for error_mark_node. + * parser.c (cp_parser_class_head): Likewise, check the tree + returned by the latter. + 2008-06-07 Paolo Carlini PR c++/35327 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 5ca1bd7e533..12d1a2d8ad9 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -14832,7 +14832,13 @@ cp_parser_class_head (cp_parser* parser, } } - maybe_process_partial_specialization (TREE_TYPE (type)); + if (maybe_process_partial_specialization (TREE_TYPE (type)) + == error_mark_node) + { + type = NULL_TREE; + goto done; + } + class_type = current_class_type; /* Enter the scope indicated by the nested-name-specifier. */ pushed_scope = push_scope (nested_name_specifier); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f141b74a6fd..eb4a7b7ed34 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -772,7 +772,11 @@ maybe_process_partial_specialization (tree type) check_specialization_namespace (CLASSTYPE_TI_TEMPLATE (type)); SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type); if (processing_template_decl) - push_template_decl (TYPE_MAIN_DECL (type)); + { + if (push_template_decl (TYPE_MAIN_DECL (type)) + == error_mark_node) + return error_mark_node; + } } else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type)) error ("specialization of %qT after instantiation", type); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 84ee84ca0a9..ee3af09b714 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-06-08 Paolo Carlini + + PR c++/35242 + * g++.dg/cpp0x/vt-35242.C: New. + 2008-06-08 Janus Weil PR fortran/36459 diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-35242.C b/gcc/testsuite/g++.dg/cpp0x/vt-35242.C new file mode 100644 index 00000000000..9cc859b875e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-35242.C @@ -0,0 +1,7 @@ +// { dg-options "-std=c++0x" } +struct A +{ + template struct B; +}; + +template struct A::B {}; // { dg-error "parameter packs|T" }