From: Paolo Carlini Date: Mon, 12 May 2008 15:18:52 +0000 (+0000) Subject: re PR c++/35331 (ICE with invalid specialization of variadic template) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d2f0ecd61495161034a7c24de59af5025b298e2;p=gcc.git re PR c++/35331 (ICE with invalid specialization of variadic template) /cp 2008-05-12 Paolo Carlini PR c++/35331 * semantics.c (begin_class_definition): Extend checks on the first argument. /testsuite 2008-05-12 Paolo Carlini PR c++/35331 * g++.dg/cpp0x/vt-35331.C: New. * g++.dg/cpp0x/pr32125.C: Adjust. * g++.dg/cpp0x/pr32126.C: Likewise. * g++.dg/cpp0x/pr31438.C: Likewise. * g++.dg/cpp0x/variadic81.C: Likewise. * g++.dg/cpp0x/vt-34055.C: Likewise. * g++.dg/cpp0x/vt-34606.C: Likewise. From-SVN: r135216 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 85deaa41fe2..49f91bab0cf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-05-12 Paolo Carlini + + PR c++/35331 + * semantics.c (begin_class_definition): Extend checks on the first + argument. + 2008-05-12 Tomas Bily * typeck2.c (digest_init): Use CONVERT_EXPR_P. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 7881a9faf1b..192cfa64197 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2223,7 +2223,7 @@ check_template_template_default_arg (tree argument) tree begin_class_definition (tree t, tree attributes) { - if (t == error_mark_node) + if (error_operand_p (t) || error_operand_p (TYPE_MAIN_DECL (t))) return error_mark_node; if (processing_template_parmlist) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 79df0e9d453..1daba114a8a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2008-05-12 Paolo Carlini + + PR c++/35331 + * g++.dg/cpp0x/vt-35331.C: New. + * g++.dg/cpp0x/pr32125.C: Adjust. + * g++.dg/cpp0x/pr32126.C: Likewise. + * g++.dg/cpp0x/pr31438.C: Likewise. + * g++.dg/cpp0x/variadic81.C: Likewise. + * g++.dg/cpp0x/vt-34055.C: Likewise. + * g++.dg/cpp0x/vt-34606.C: Likewise. + 2008-05-12 Ira Rosen * gfortran.dg/vect/pr36119.f: Rename to ... diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31438.C b/gcc/testsuite/g++.dg/cpp0x/pr31438.C index 4763918b0ef..74738830ad1 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr31438.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr31438.C @@ -2,8 +2,8 @@ template struct A; template struct A // { dg-error "parameter packs|U" } -{ // { dg-error "parameter packs|U" } - template A(X); // { dg-error "parameter packs|U" } +{ + template A(X); }; A a(0); // { dg-error "incomplete type" } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr32125.C b/gcc/testsuite/g++.dg/cpp0x/pr32125.C index 048cf454484..210a29c0829 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr32125.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr32125.C @@ -2,7 +2,7 @@ template struct A; template struct A // { dg-error "not expanded|T" } -{ // { dg-error "not expanded|T" } - A(); // { dg-error "not expanded|T" } - A(T); // { dg-error "not expanded|T" } +{ + A(); + A(T); }; diff --git a/gcc/testsuite/g++.dg/cpp0x/pr32126.C b/gcc/testsuite/g++.dg/cpp0x/pr32126.C index a344567dff9..c525cca684b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr32126.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr32126.C @@ -2,7 +2,7 @@ template struct A; template struct A // { dg-error "not expanded|T|" } -{ // { dg-error "not expanded|T|" } +{ static int i; }; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic81.C b/gcc/testsuite/g++.dg/cpp0x/variadic81.C index c5673789ca9..cce61b31649 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic81.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic81.C @@ -4,7 +4,7 @@ template struct A; template struct A // { dg-error "not expanded|T|not used|T" } -{ // { dg-error "not expanded|T|not used|T" } +{ struct B; }; diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34055.C b/gcc/testsuite/g++.dg/cpp0x/vt-34055.C index 29066b50bd7..c50778430e0 100644 --- a/gcc/testsuite/g++.dg/cpp0x/vt-34055.C +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34055.C @@ -3,8 +3,8 @@ template struct A; template struct A // { dg-error "parameter packs|T" } -{ // { dg-error "parameter packs|T" } - void foo(); // { dg-error "parameter packs|T|candidate" } +{ + void foo(); }; template void A::foo() {} // { dg-error "invalid declarator" } @@ -14,8 +14,8 @@ template void A::foo() {} // { dg-error "invalid declarator" } template struct B; template struct B // { dg-error "parameter packs|T" } -{ // { dg-error "parameter packs|T" } - void foo(); // { dg-error "parameter packs|T" } +{ + void foo(); }; template void B::foo() {} // { dg-error "invalid declarator" } @@ -24,8 +24,8 @@ template void B::foo() {} // { dg-error "invalid declarator" } template struct C; template struct C // { dg-error "parameter packs|T" } -{ // { dg-error "parameter packs|T" } - void foo(); // { dg-error "parameter packs|T" } +{ + void foo(); }; template void C::foo() {} // { dg-error "invalid declarator" } diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34606.C b/gcc/testsuite/g++.dg/cpp0x/vt-34606.C index f62e2d54118..46794335442 100644 --- a/gcc/testsuite/g++.dg/cpp0x/vt-34606.C +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34606.C @@ -2,8 +2,8 @@ template struct A; template struct A // { dg-error "parameter packs|U" } -{ // { dg-error "parameter packs|U" } +{ template struct B; - template struct B {}; // { dg-error "parameter packs|U" } + template struct B {}; }; diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-35331.C b/gcc/testsuite/g++.dg/cpp0x/vt-35331.C new file mode 100644 index 00000000000..0add9819bd0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-35331.C @@ -0,0 +1,7 @@ +// { dg-options "-std=c++0x" } +template struct A; + +template struct A // { dg-error "not expanded|T" } +{ + friend void foo(); +};