Bug 40557 - [4.5 Regression] ICE with template union
Summary: [4.5 Regression] ICE with template union
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P1 normal
Target Milestone: 4.5.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2009-06-26 06:06 UTC by Volker Reichelt
Modified: 2009-07-06 05:05 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-07-04 13:21:14


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2009-06-26 06:06:47 UTC
The following valid code snippet triggers an ICE on the trunk:

==============================
struct A
{
  typedef int X;
};

template<int> union B
{
  A::X x;
};
==============================

bug.cc:8:6: internal compiler error: in append_type_to_template_for_access_check_1, at cp/pt.c:17353
Please submit a full bug report, [etc.]

The regression appeared between 2009-05-22 and 2009-06-01.
Looks like it was caused by the following patch:

2009-05-26  Dodji Seketeli  <dodji@redhat.com>

	PR c++/40007
	* cp-tree.h (MEMBER_TYPES_NEEDING_ACCESS_CHECK): Remove this accessor.
	(TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): New accessor.
	(get_types_needing_access_check): Declare new entry point.
	* pt.c (append_type_to_template_for_access_check_1,
	get_types_needing_access_check): New functions.
        [...]
Comment 1 Simon Martin 2009-07-04 13:21:14 UTC
Patch submitted here:
  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00213.html
Comment 2 Simon Martin 2009-07-06 04:55:36 UTC
Subject: Bug 40557

Author: simartin
Date: Mon Jul  6 04:55:20 2009
New Revision: 149276

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149276
Log:
gcc/cp/

2009-07-06  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/40557
	* pt.c (perform_typedefs_access_check, get_types_needing_access_check,
	append_type_to_template_for_access_check_1): Use
	RECORD_OR_UNION_CODE_P.

gcc/testsuite/

2009-07-06  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/40557
	* g++.dg/template/union2.C: New test.

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

Comment 3 Simon Martin 2009-07-06 05:05:44 UTC
Fixed in 4.5
Comment 4 hjl@gcc.gnu.org 2009-07-08 14:30:44 UTC
Subject: Bug 40557

Author: hjl
Date: Wed Jul  8 14:30:12 2009
New Revision: 149371

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149371
Log:
2009-07-08  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-07-06  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/40557
	* g++.dg/template/union2.C: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/union2.C
      - copied unchanged from r149370, trunk/gcc/testsuite/g++.dg/template/union2.C
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog