From: paolo Date: Tue, 11 May 2010 20:53:36 +0000 (+0000) Subject: /cp X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=a6d829e3c3f009d65f0833f7f91e21d983acf1fe /cp 2010-05-11 Paolo Carlini PR c++/34272 PR c++/43630 PR c++/34491 * pt.c (process_partial_specialization): Return error_mark_node in case of unused template parameters in partial specialization. /testsuite 2010-05-11 Paolo Carlini PR c++/34272 PR c++/43630 PR c++/34491 * g++.dg/template/crash97.C: New. * g++.dg/template/crash98.C: Likewise. * g++.dg/template/crash99.C: Likewise. * g++.dg/cpp0x/pr31439.C: Adjust. * g++.dg/template/crash95.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159295 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 597f8f1bcf9..58a57e05e51 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2010-05-11 Paolo Carlini + + PR c++/34272 + PR c++/43630 + PR c++/34491 + * pt.c (process_partial_specialization): Return error_mark_node + in case of unused template parameters in partial specialization. + 2010-05-11 Jakub Jelinek PR c++/44062 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 06f5d9f2313..1ff1fe2b577 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1,6 +1,6 @@ /* Handle parameterized types (templates) for GNU C++. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 + 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing. Rewritten by Jason Merrill (jason@cygnus.com). @@ -3837,7 +3837,7 @@ process_partial_specialization (tree decl) int nargs = TREE_VEC_LENGTH (inner_args); int ntparms; int i; - int did_error_intro = 0; + bool did_error_intro = false; struct template_parm_data tpd; struct template_parm_data tpd2; @@ -3899,12 +3899,15 @@ process_partial_specialization (tree decl) if (!did_error_intro) { error ("template parameters not used in partial specialization:"); - did_error_intro = 1; + did_error_intro = true; } error (" %qD", TREE_VALUE (TREE_VEC_ELT (inner_parms, i))); } + if (did_error_intro) + return error_mark_node; + /* [temp.class.spec] The argument list of the specialization shall not be identical to diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ee0fab84ca2..11d07465150 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2010-05-11 Paolo Carlini + + PR c++/34272 + PR c++/43630 + PR c++/34491 + * g++.dg/template/crash97.C: New. + * g++.dg/template/crash98.C: Likewise. + * g++.dg/template/crash99.C: Likewise. + * g++.dg/cpp0x/pr31439.C: Adjust. + * g++.dg/template/crash95.C: Likewise. + 2010-05-11 Jakub Jelinek PR middle-end/44071 diff --git a/gcc/testsuite/g++.dg/template/crash95.C b/gcc/testsuite/g++.dg/template/crash95.C index 959a9d066ac..2ad9e981666 100644 --- a/gcc/testsuite/g++.dg/template/crash95.C +++ b/gcc/testsuite/g++.dg/template/crash95.C @@ -8,4 +8,4 @@ template < typename > struct S }; }; -S < int > s(0); +S < int > s(0); // { dg-error "incomplete type" }