This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/27568] New: ICE in check_classfn, at cp/decl2.c:607
- From: "benoit dot sigoure at lrde dot epita dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 May 2006 04:33:01 -0000
- Subject: [Bug c++/27568] New: ICE in check_classfn, at cp/decl2.c:607
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
$ g++-4.1 -v -c -W -Wall -pedantic --save-temps ice.check_classfn.cc
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,fortran,objc,obj-c++,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre --enable-mpfr
--with-tune=i686 --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.0 (Debian 4.1.0-1+b1)
/usr/lib/gcc/i486-linux-gnu/4.1.0/cc1plus -E -quiet -v -D_GNU_SOURCE
ice.bak.cc -mtune=i686 -W -Wall -pedantic -fpch-preprocess -o ice.bak.ii
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i486-linux-gnu/4.1.0/../../../../include/c++/4.1.0
/usr/lib/gcc/i486-linux-gnu/4.1.0/../../../../include/c++/4.1.0/i486-linux-gnu
/usr/lib/gcc/i486-linux-gnu/4.1.0/../../../../include/c++/4.1.0/backward
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.1.0/include
/usr/include
End of search list.
/usr/lib/gcc/i486-linux-gnu/4.1.0/cc1plus -fpreprocessed ice.bak.ii -quiet
-dumpbase ice.bak.cc -mtune=i686 -auxbase ice.bak -W -Wall -pedantic -version
-o ice.bak.s
GNU C++ version 4.1.0 (Debian 4.1.0-1+b1) (i486-linux-gnu)
compiled by GNU C version 4.1.0 (Debian 4.1.0-1+b1).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 5cea2708e3389929ecfbb4a4e1ff0f61
ice.bak.cc:30: internal compiler error: in check_classfn, at cp/decl2.c:607
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/cc5yM1X4.out file, please attach this to
your bugreport.
Release:
g++-4.1 (GCC) 4.1.0 (Debian 4.1.0-1+b1)
Environment:
Linux warszawa 2.6.16.13-debian-etch-lrde-v6 #1 SMP PREEMPT Wed May 3 15:48:47
CEST 2006 i686 GNU/Linux
How-To-Repeat:
Source is:
template <typename T>
struct empty
{
};
template <template <typename A> class B>
class foo
{
};
template <template <typename A> class B>
struct bar
{
template <typename T>
void meth (T&);
};
template < >
template <template <typename A> class B>
void bar<empty>::meth (foo<B>& f)
{
}
Notes:
The code compiles with g++-3.3 (GCC) 3.3.6 (Debian 1:3.3.6-13) and g++-3.4
(GCC) 3.4.6 (Debian 3.4.6-1)
It also ICEs with g++-4.0 (GCC) 4.0.3 (Debian 4.0.3-1)
It doesn't compile with Intel's compiler icpc (ICC) 9.0 20050430:
$ icpc -c ice.check_classfn.cc
ice.check_classfn.cc(30): error: declaration is incompatible with function
template "void bar<B>::meth(T &) [with B=empty]" (declared at line 25)
void bar<empty>::meth (foo<B>& f)
^
compilation aborted for ice.check_classfn.cc (code 2)
Compilation finished, icpc returned 2
Although it compiles with g++-3.3 and 3.4 I doubt this code is valid. bar::meth
is specialized in a weird manner and we didn't find whether this is allowed by
the C++ standard.
In particular, since bar::meth is templated with a simple template <typename
T>, is it allowed to specialize it by requiring that T is itself templated?
(which is what this code tries to do)
By the way, if we remove bar::meth's argument, it won't ICE anymore and most
compilers (g++ 2.95 3.3 3.4 4.0 4.1 and icpc 9.0) will agree on the fact that
'void bar<empty>::meth()' does not match any template declaration.
--
Summary: ICE in check_classfn, at cp/decl2.c:607
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: benoit dot sigoure at lrde dot epita dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27568