Attempt to create a partial specialization of a function template (problem 1) with a type `void' used as a function argument type (problem 2) causes an internal compiler error. Release: 3.3 20020916 (experimental) Environment: System: FreeBSD arcturus.student.iastate.edu 4.6-STABLE FreeBSD 4.6-STABLE #15: Sat Aug 24 23:25:48 CDT 2002 kparz@arcturus.student.iastate.edu:/usr/obj/usr/src/sys/ARCTURUS i386 host: i386-unknown-freebsd4.6 build: i386-unknown-freebsd4.6 target: i386-unknown-freebsd4.6 configured with: ../gcc/configure --prefix=/u/gcc-20020916 --enable-languages=c,c++,f77 How-To-Repeat: # 1 "gcc-ice1.cc" # 1 "<built-in>" # 1 "<command line>" # 1 "gcc-ice1.cc" template <class T, class U> void foo(T, U) {} template <class T> void foo<T,void>(T, void) {}
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed.
From: "Giovanni Bajo" <giovannibajo@libero.it> To: <gcc-gnats@gcc.gnu.org>, <kparz@iastate.edu>, <gcc-bugs@gcc.gnu.org>, <nobody@gcc.gnu.org>, <gcc-prs@gcc.gnu.org> Cc: Subject: Re: c++/7939: [3.3/3.4 regression] [2003-05-03] ICE on function template specialization Date: Mon, 5 May 2003 02:46:22 +0200 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7939 This is a regression from 2.95. Currently, we get the following on mainline and 3.3: pr7939.cpp:2: error: `<anonymous>' has incomplete type pr7939.cpp:2: error: invalid use of `void' pr7939.cpp:2: error: partial specialization `foo<T, void>' of function template pr7939.cpp:2: internal compiler error: in comptypes, at cp/typeck.c:913 Please submit a full bug report, while we used to get this on 2.95: pr7939.cpp:2: template-id `foo<T, void>' in declaration of primary template So, there is actually an improvement on the error message (the parser is able to understand that the code is trying to define a partial specialization of a function template, which is indeed a great diagnostic), but then it ICEs during error recovery. I think the error message could also be a little epurated (removing those other lines if possible, especially the one with <anonymous> which is really cryptic), and maybe specifying explicitally that "partial specialization of function template is not allowed by ISO C++". Giovanni Bajo
Moving target back to 3.3.1.
It also ICEs in 3.0.4.
Postponed until GCC 3.3.2.
FWIW it was broken in "2.97 20001230 (experimental)" already so it's really old. : Test is the same (fail) at both endpoints (2000-12-31-trunk, : 2003-07-13-trunk)
Still there on mainline (20030817). Not target specific, so removing target info.
Postponing ICE-after-valid until GCC 3.4.
Subject: Bug 7939 CVSROOT: /cvs/gcc Module name: gcc Changes by: lerdsuwa@gcc.gnu.org 2003-09-16 15:27:51 Modified files: gcc/cp : ChangeLog typeck.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: crash11.C Log message: PR c++/7939 * typeck.c (comptypes): Don't ICE when its first argument is error_mark_node. (compparms): Reverse the arguments of same_type_p. * g++.dg/template/crash11.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3681&r2=1.3682 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.503&r2=1.504 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3058&r2=1.3059 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash11.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed on mainline (future GCC 3.4) by patch http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01033.html I am keeping this open to see if it can get into 3.3.2 as well.
Patch for 3.3 branch submitted: http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01681.html
Subject: Re: [3.3 regression] ICE on function template specialization On Sat, 2003-10-04 at 02:06, andreas dot meier_ at gmx dot de wrote: > PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7939 This patch is OK.
Subject: Bug 7939 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: mmitchel@gcc.gnu.org 2003-10-16 02:31:00 Modified files: gcc/cp : ChangeLog typeck.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: crash11.C Log message: PR c++/7939 * typeck.c (comptypes): Don't ICE when its first argument is error_mark_node. (compparms): Reverse the arguments of same_type_p. PR c++/7939 * g++.dg/template/crash11.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.215&r2=1.3076.2.216 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.436.2.18&r2=1.436.2.19 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.306&r2=1.2261.2.307 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash11.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.12.1
Fixed in GCC 3.3.2.
Subject: Bug 7939 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: mmitchel@gcc.gnu.org 2003-10-16 09:34:00 Modified files: gcc : tree.h gcc/cp : ChangeLog decl.c friend.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: friend25.C Log message: PR c++/12369 * g++.dg/template/friend25.C: New test. PR c++/7939 * g++.dg/template/crash11.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.367.2.6&r2=1.367.2.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.216&r2=1.3076.2.217 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.965.2.63&r2=1.965.2.64 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/friend.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.77.4.2&r2=1.77.4.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.307&r2=1.2261.2.308 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend25.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1