The following invalid testcase triggers an ICE on mainline and 4.1 branch: ======================================================== template<int> struct A { template<typename> void foo(); }; template<int> template<typename> void A<0>::foo() {} ======================================================== bug.cc:6: internal compiler error: in check_classfn, at cp/decl2.c:579 Please submit a full bug report, [etc.] The regression happened between 4.1.1 and 4.1.2-20060714 on the 4.1 branch. The problem is related to PR 27962.
Confirmed.
Janis, Can you do a regression hunt on this bug? Thanks, Andrew
Hi Janis, a regression hunt would be useful, indeed... Thanks!
A regression hunt on mainline using the submitter's testcase identified the following patch: http://gcc.gnu.org/viewcvs?view=rev&rev=114023 r114023 | mmitchel | 2006-05-23 20:45:44 +0000 (Tue, 23 May 2006)
Let's try to fix this...
Patch at: http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01195.html
The patch is approved at http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00392.html
Subject: Bug 28743 Author: paolo Date: Thu Feb 14 12:34:42 2008 New Revision: 132316 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132316 Log: /cp 2008-02-14 Paolo Carlini <pcarlini@suse.de> PR c++/28743 * pt.c (determine_specialization): In case of function templates, when the type of DECL does not match FN there is no match. /testsuite 2008-02-14 Paolo Carlini <pcarlini@suse.de> PR c++/28743 * g++.dg/template/nontype17.C: New. * g++.dg/template/nontype16.C: Add error. Added: trunk/gcc/testsuite/g++.dg/template/nontype17.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/template/nontype16.C
Fixed for 4.3.0.
Subject: Bug 28743 Author: paolo Date: Fri Feb 22 11:02:00 2008 New Revision: 132543 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132543 Log: /testsuite 2008-02-22 Paolo Carlini <pcarlini@suse.de> PR c++/35282 * g++.dg/template/nontype17.C: Add. /cp 2008-02-22 Paolo Carlini <pcarlini@suse.de> PR c++/35282 Revert: 2008-02-14 Paolo Carlini <pcarlini@suse.de> PR c++/28743 * pt.c (determine_specialization): In case of function templates, when the type of DECL does not match FN there is no match. /testsuite 2008-02-22 Paolo Carlini <pcarlini@suse.de> PR c++/35282 Revert: 2008-02-14 Paolo Carlini <pcarlini@suse.de> PR c++/28743 * g++.dg/template/nontype17.C: New. * g++.dg/template/nontype16.C: Add error. Added: trunk/gcc/testsuite/g++.dg/template/nontype17.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/template/nontype16.C
Subject: Bug 28743 Author: paolo Date: Fri Feb 22 11:02:31 2008 New Revision: 132544 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132544 Log: /testsuite 2008-02-22 Paolo Carlini <pcarlini@suse.de> PR c++/35282 * g++.dg/template/nontype17.C: Add. /cp 2008-02-22 Paolo Carlini <pcarlini@suse.de> PR c++/35282 Revert: 2008-02-14 Paolo Carlini <pcarlini@suse.de> PR c++/28743 * pt.c (determine_specialization): In case of function templates, when the type of DECL does not match FN there is no match. /testsuite 2008-02-22 Paolo Carlini <pcarlini@suse.de> PR c++/35282 Revert: 2008-02-14 Paolo Carlini <pcarlini@suse.de> PR c++/28743 * g++.dg/template/nontype17.C: New. * g++.dg/template/nontype16.C: Add error. Modified: branches/gcc-4_3-branch/gcc/cp/ChangeLog branches/gcc-4_3-branch/gcc/cp/pt.c branches/gcc-4_3-branch/gcc/testsuite/g++.dg/template/nontype16.C branches/gcc-4_3-branch/gcc/testsuite/g++.dg/template/nontype17.C
Subject: Bug 28743 Author: paolo Date: Fri Feb 22 11:03:17 2008 New Revision: 132545 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132545 Log: /testsuite 2008-02-22 Paolo Carlini <pcarlini@suse.de> PR c++/35282 * g++.dg/template/nontype17.C: Add. /cp 2008-02-22 Paolo Carlini <pcarlini@suse.de> PR c++/35282 Revert: 2008-02-14 Paolo Carlini <pcarlini@suse.de> PR c++/28743 * pt.c (determine_specialization): In case of function templates, when the type of DECL does not match FN there is no match. /testsuite 2008-02-22 Paolo Carlini <pcarlini@suse.de> PR c++/35282 Revert: 2008-02-14 Paolo Carlini <pcarlini@suse.de> PR c++/28743 * g++.dg/template/nontype17.C: New. * g++.dg/template/nontype16.C: Add error. Modified: branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
Unfortunately, back to a 4.3 (and 4.4) regression.
Closing 4.1 branch.
What was the problem with this patch?
It caused c++/35282...
Subject: Bug 28743 Author: jason Date: Wed Nov 26 03:51:40 2008 New Revision: 142212 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142212 Log: PR c++/28743 * decl2.c (check_classfn): Error rather than abort on parameter list mismatch. Added: trunk/gcc/testsuite/g++.dg/template/nontype18.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl2.c trunk/gcc/testsuite/ChangeLog
Fixed for 4.4, no need to fix ice-on-invalid in earlier releases.