This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
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
Created an attachment (id=6222) [edit] Testcase
Created an attachment (id=6223) [edit] Testcase
Confirmed.
Working on a fix.
Subject: Bug 15285 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: mmitchel@gcc.gnu.org 2004-05-22 21:43:59 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog pt.c 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/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.178&r2=1.3389.2.179 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.101&r2=1.3892.2.102 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.24&r2=1.816.2.25 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/non-dependent5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/non-dependent6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
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
Fixed in GCC 3.4.1.
*** Bug 15658 has been marked as a duplicate of this bug. ***