This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix PR c++/27713: ICE on invalid operator new
- From: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 May 2006 17:15:30 +0200 (CEST)
- Subject: [patch] Fix PR c++/27713: ICE on invalid operator new
The following patch fixes PR c++/27713 (which is a 4.0/4.1 regression)
by backporting the fix for PR c++/27559 from mainline to the 4.1 and
4.0 branch.
Bootstrapped and regtested on x86_64-unknown-linux-gnu.
Ok for 4.1 and 4.0 branch?
Testcase also for mainline?
Regards,
Volker
:ADDPATCH C++:
2006-05-29 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27713
* pt.c (push_template_decl_real): Return error_mark_node instead
of broken decl.
===================================================================
--- gcc/gcc/cp/pt.c 2006/05/15 08:52:29 113776
+++ gcc/gcc/cp/pt.c 2006/05/15 08:58:25 113777
@@ -3009,7 +3009,7 @@
template. ... Template allocation functions shall
have two or more parameters. */
error ("invalid template declaration of %qD", decl);
- return decl;
+ return error_mark_node;
}
}
else if (DECL_IMPLICIT_TYPEDEF_P (decl)
===================================================================
2006-05-29 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27713
* g++.dg/template/new5.C: New test.
===================================================================
--- gcc/gcc/testsuite/g++.dg/template/new5.C 2005-08-29 00:25:44 +0200
+++ gcc/gcc/testsuite/g++.dg/template/new5.C 2006-05-24 12:46:20 +0200
@@ -0,0 +1,7 @@
+// PR c++/27713
+// { dg-do compile }
+
+struct A
+{
+ template<int> friend void* operator new(__SIZE_TYPE__); // { dg-error "invalid template" }
+};
===================================================================