The following invalid code snippet triggers an ICE since GCC 4.3.0: ========================== struct A { A() { void A(); } }; ========================== bug.cc: In constructor 'A::A()': bug.cc:3: error: return type specification for constructor invalid bug.cc:3: internal compiler error: in copy_fn_p, at cp/decl.c:9677 Please submit a full bug report, [etc.]
Confirmed.
Introduced by my fix for PR29077
Patch submitted here http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00079.html
GCC 4.3.3 is being released, adjusting target milestone.
Approved patch: http://gcc.gnu.org/ml/gcc-patches/2009-03/msg01080.html
Subject: Bug 37647 Author: hjl Date: Fri Mar 27 13:17:37 2009 New Revision: 145105 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145105 Log: gcc/cp/ 2009-03-27 Simon Martin <simartin@users.sourceforge.net> PR c++/37647 * decl.c (grokdeclarator): Reject [con|de]stuctors in a non-class scope. gcc/testsuite/ 2009-03-27 Simon Martin <simartin@users.sourceforge.net> PR c++/37647 * g++.dg/parse/ctor9.C: New test. Added: trunk/gcc/testsuite/g++.dg/parse/ctor9.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/testsuite/ChangeLog
WONTFIX for 4.3.