This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] PR 34603
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 24 Jan 2008 12:30:26 +0100
- Subject: [C++ Patch] PR 34603
Hi,
this tiny change fixes the P4 ice-on-invalid. I also checked that the
full error message, pointing out the incomplete type and the missing
')', compares well to that provided by other implementations. Regtested
x86_64_linux.
Ok for mainline?
Paolo.
////////////////////
/cp
2008-01-24 Paolo Carlini <pcarlini@suse.de>
PR c++/34603
* pt.c (push_template_decl_real): Return error_mark_node in case
of template definition of non-template.
/testsuite
2008-01-24 Paolo Carlini <pcarlini@suse.de>
PR c++/34603
* g++.dg/template/crash77.C: New.
Index: testsuite/g++.dg/template/crash77.C
===================================================================
*** testsuite/g++.dg/template/crash77.C (revision 0)
--- testsuite/g++.dg/template/crash77.C (revision 0)
***************
*** 0 ****
--- 1,5 ----
+ // PR c++/34603
+
+ template<typename> struct A; // { dg-error "declaration" }
+
+ template<typename T> A<T>::A( struct A; // { dg-error "definition|expected|incomplete" }
Index: cp/pt.c
===================================================================
*** cp/pt.c (revision 131777)
--- cp/pt.c (working copy)
***************
*** 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 Free Software Foundation, Inc.
Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
Rewritten by Jason Merrill (jason@cygnus.com).
--- 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 Free Software Foundation, Inc.
Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
Rewritten by Jason Merrill (jason@cygnus.com).
*************** push_template_decl_real (tree decl, bool
*** 3977,3983 ****
if (!tinfo)
{
error ("template definition of non-template %q#D", decl);
! return decl;
}
tmpl = TI_TEMPLATE (tinfo);
--- 3977,3983 ----
if (!tinfo)
{
error ("template definition of non-template %q#D", decl);
! return error_mark_node;
}
tmpl = TI_TEMPLATE (tinfo);