Bug 15285 - [3.4/4.0 regression] instantiate_type ICE when forming pointer to template function
Summary: [3.4/4.0 regression] instantiate_type ICE when forming pointer to template fu...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 critical
Target Milestone: 3.4.1
Assignee: Mark Mitchell
URL:
Keywords: ice-on-valid-code
: 15658 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-04 19:52 UTC by Robert Evans
Modified: 2004-10-30 21:11 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work: 3.3.3
Known to fail: 3.4.0 4.0.0
Last reconfirmed: 2004-05-04 19:58:48


Attachments
Testcase (91 bytes, text/plain)
2004-05-04 19:53 UTC, Robert Evans
Details
Testcase (119 bytes, text/plain)
2004-05-04 19:58 UTC, Robert Evans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Evans 2004-05-04 19:52:02 UTC
The compiler throws an ICE when trying to form a pointer to an instance of a
template function from within a different template function.  This worked in
gcc-3.3.3 and is also broken in the mainline.

***tf.C****************

void foo(void (*func)()) {}

template<typename T>
void bar()
{}

template<typename T>
void baz()
{
        foo(&bar<long>);
}

**********************

$ g++ tf.C
tf.C: In member function `void Class<Type>::foo(Object*)':
tf.C:18: internal compiler error: in instantiate_type, at cp/class.c:6164

$ g++ -v
Reading specs from /home/bob/bin/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ../gcc/configure --enable-threads=posix
--enable-languages=c,c++ --prefix=/home/bob/bin/gcc-3.4
Thread model: posix
gcc version 3.4.0
Comment 1 Robert Evans 2004-05-04 19:53:51 UTC
Created attachment 6222 [details]
Testcase
Comment 2 Robert Evans 2004-05-04 19:58:35 UTC
Created attachment 6223 [details]
Testcase
Comment 3 Andrew Pinski 2004-05-04 19:58:48 UTC
Confirmed.
Comment 4 Mark Mitchell 2004-05-22 19:42:02 UTC
Working on a fix.
Comment 6 CVS Commits 2004-05-22 21:45:33 UTC
Subject: Bug 15285

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-05-22 21:45:25

Modified files:
	gcc/cp         : ChangeLog pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: non-dependent5.C non-dependent6.C 

Log message:
	PR c++/15285
	PR c++/15299
	* pt.c (build_non_dependent_expr): Expand the set of tree nodes
	recognized as overloaded functions.
	
	PR c++/15285
	PR c++/15299
	* g++.dg/template/non-dependent5.C: New test.
	* g++.dg/template/non-dependent6.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4051&r2=1.4052
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.851&r2=1.852
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3770&r2=1.3771
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/non-dependent5.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/non-dependent6.C.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 7 Mark Mitchell 2004-05-22 21:47:07 UTC
Fixed in GCC 3.4.1.
Comment 8 Andrew Pinski 2004-05-26 04:22:45 UTC
*** Bug 15658 has been marked as a duplicate of this bug. ***