Bug 11509 - [3.4 regression] ICE with expression with static member in template arg
Summary: [3.4 regression] ICE with expression with static member in template arg
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 critical
Target Milestone: 3.4.0
Assignee: Mark Mitchell
URL:
Keywords: ice-on-valid-code
: 11511 (view as bug list)
Depends on:
Blocks: 10316
  Show dependency treegraph
 
Reported: 2003-07-12 23:01 UTC by Wolfgang Bangerth
Modified: 2004-01-17 04:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-07-12 23:14:25


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Bangerth 2003-07-12 23:01:47 UTC
This is reduced from 10316, but it was too simple to be fun (less than 3 minutes
to cut down :-):
-----------------------------
template <class> struct A { static const int n = 1; } ;
template <int> struct B;

template <class S>
struct restype_order {
    static const int s = A<S>::n;
    typedef typename B<(s > 0)>::t t;
};
-----------------------------

This ICEs not with present mainline:
tmp/gg> ../build-gcc/gcc-install/bin/c++ -c x.cc
x.cc:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

It doesn't ICE with 3.3.0, but I don't have a 3.3 branch snapshot on this
machine, so can't test whether this bug also is on the branch. It's a regression
in any case. The bug was introduced into mainline after 20030520.

W.
Comment 1 Andrew Pinski 2003-07-12 23:10:59 UTC
I am not going to confirm this because I was the one who orignally reported as ICE'ing but it does 
not ICE in 3.3.1 (20030707).
Using Phil's regression hunter: Search converges between 2003-07-08-trunk (#258) and 2003-
07-09-trunk (#259). And it passes with 3.3.1 (20030712).
Comment 2 Wolfgang Bangerth 2003-07-12 23:14:25 UTC
I guess your word is enough -- it just takes a second person on a second system to 
confirm that something doesn't work. If you say it doesn't, and the regression finder 
agrees, that should be ok. 
 
Thanks 
  W. 
Comment 3 Andrew Pinski 2003-07-12 23:16:35 UTC
Looking at Nathanael's comment 19 in bug 11489, this looks very much related to that bug.
Comment 4 Wolfgang Bangerth 2003-07-13 00:04:07 UTC
PR 11489 is now PR 11511. 
W. 
Comment 5 GCC Commits 2003-07-14 21:32:28 UTC
Subject: Bug 11509

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-07-14 21:32:26

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

Log message:
	PR c++/11509
	* pt.c (dependent_scope_ref_p): New function.
	(value_dependent_expression_p): Use it.
	(type_dependent_expression_p): Likewise.
	
	* pt.c (tsubst_friend_function): Use reregister_specialization.
	
	PR c++/11509
	* g++.dg/template/crash6.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3522&r2=1.3523
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.725&r2=1.726
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2875&r2=1.2876
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 6 Mark Mitchell 2003-07-14 21:42:37 UTC
Fixed in GCC 3.4.
Comment 7 Mark Mitchell 2003-07-14 21:43:40 UTC
*** Bug 11511 has been marked as a duplicate of this bug. ***