Bug 28743 - [4.2/4.3/4.4 regression] ICE with invalid specialization
Summary: [4.2/4.3/4.4 regression] ICE with invalid specialization
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P2 normal
Target Milestone: 4.4.0
Assignee: Jason Merrill
URL:
Keywords: ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-08-15 19:15 UTC by Volker Reichelt
Modified: 2009-04-29 15:22 UTC (History)
9 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.1.1
Known to fail:
Last reconfirmed: 2008-11-20 20:31:16


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-08-15 19:15:38 UTC
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.
Comment 1 Andrew Pinski 2006-08-18 04:47:45 UTC
Confirmed.
Comment 2 Andrew Pinski 2007-01-09 19:25:05 UTC
Janis,
  Can you do a regression hunt on this bug?
Thanks, Andrew
Comment 3 Paolo Carlini 2007-09-24 09:15:35 UTC
Hi Janis, a regression hunt would be useful, indeed... Thanks!
Comment 4 Janis Johnson 2007-09-27 22:11:15 UTC
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)
Comment 5 Paolo Carlini 2008-01-24 21:31:34 UTC
Let's try to fix this...
Comment 6 Paolo Carlini 2008-01-26 10:09:17 UTC
Patch at: http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01195.html
Comment 7 andreasmeier80 2008-02-14 00:35:08 UTC
The patch is approved at http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00392.html
Comment 8 paolo@gcc.gnu.org 2008-02-14 12:35:27 UTC
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

Comment 9 Paolo Carlini 2008-02-14 12:37:18 UTC
Fixed for 4.3.0.
Comment 10 paolo@gcc.gnu.org 2008-02-22 11:02:49 UTC
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

Comment 11 paolo@gcc.gnu.org 2008-02-22 11:03:23 UTC
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

Comment 12 paolo@gcc.gnu.org 2008-02-22 11:04:14 UTC
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

Comment 13 Paolo Carlini 2008-02-22 11:07:11 UTC
Unfortunately, back to a 4.3 (and 4.4) regression.
Comment 14 Joseph S. Myers 2008-07-04 21:27:26 UTC
Closing 4.1 branch.
Comment 15 Manuel López-Ibáñez 2008-11-03 11:56:09 UTC
What was the problem with this patch?
Comment 16 Paolo Carlini 2008-11-03 17:10:39 UTC
It caused c++/35282...
Comment 17 Jason Merrill 2008-11-26 03:53:04 UTC
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

Comment 18 Jason Merrill 2008-12-02 17:07:45 UTC
Fixed for 4.4, no need to fix ice-on-invalid in earlier releases.