Bug 24671 - [4.0/4.1/4.2 regression] ICE with zero-sized arrays
Summary: [4.0/4.1/4.2 regression] ICE with zero-sized arrays
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.3
: P2 normal
Target Milestone: 4.0.3
Assignee: Mark Mitchell
URL:
Keywords: ice-on-invalid-code, ice-on-valid-code, monitored
Depends on: 19208 19989
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-04 11:47 UTC by Volker Reichelt
Modified: 2005-12-23 23:24 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-04 13:19:06


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2005-11-04 11:47:10 UTC
The following testcase causes an ICE:

==============================================
template<typename> struct A
{
    typedef int X;
    static const int i = 0;
};

template<typename> struct B
{
    typedef typename A<char[A<B>::i]>::X Y;
    template<typename T> B(T, Y);
};

B<int> b(0,0);
==============================================

dPR19208B.cc:10: internal compiler error: in push_access_scope, at cp/pt.c:176
Please submit a full bug report, [etc.]

The testcase crashed since at least gcc 2.95.3, but was fixed with the
patch for PR19208. The problem reappeared on the 3.4 branch and mainline
with Josh's patch for PR 19989.

I think the code should be accepted at least with -fpermissive,
but rejected with -pedantic.
Comment 1 Andrew Pinski 2005-11-04 13:19:06 UTC
Confirmed.
Comment 2 Mark Mitchell 2005-11-19 01:58:36 UTC
We should try to fix this, but zero-sized arrays are non-standard, so P2.
Comment 3 Mark Mitchell 2005-12-23 23:16:16 UTC
Subject: Bug 24671

Author: mmitchel
Date: Fri Dec 23 23:16:12 2005
New Revision: 109022

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109022
Log:
	PR c++/24671
	* pt.c (instantiate_template): Handle SFINAE.
	PR c++/24671
	* g++.dg/template/sfinae3.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/sfinae3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Mark Mitchell 2005-12-23 23:17:15 UTC
Subject: Bug 24671

Author: mmitchel
Date: Fri Dec 23 23:17:12 2005
New Revision: 109023

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109023
Log:
	PR c++/24671
	* pt.c (instantiate_template): Handle SFINAE.
	PR c++/24671
	* g++.dg/template/sfinae3.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/sfinae3.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/pt.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 5 Mark Mitchell 2005-12-23 23:18:09 UTC
Subject: Bug 24671

Author: mmitchel
Date: Fri Dec 23 23:18:06 2005
New Revision: 109024

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109024
Log:
	PR c++/24671
	* pt.c (instantiate_template): Handle SFINAE.
	PR c++/24671
	* g++.dg/template/sfinae3.C: New test.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/template/sfinae3.C
Modified:
    branches/gcc-4_0-branch/gcc/cp/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/pt.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog

Comment 6 Mark Mitchell 2005-12-23 23:24:23 UTC
Fixed in 4.0.3.