Bug#355909: g++-4.0: Internal compiler error in instantiate_decl, at cp/pt.c:11539
Package: g++-4.0
Version: 4.0.2-10
Severity: normal
g++-4.0 (version 4.0.2-10) dies with an ICE on this (invalid) piece of
code:
template <typename T>
struct foo
{
static const int i;
};
template <typename T>
const int foo<float>::i = 42;
int
main ()
{
return foo<float>::i;
}
~ % g++ g++-4.0.3-ice.cc
g++-4.0.3-ice.cc: In function 'int main()':
g++-4.0.3-ice.cc:13: instantiated from 'const int foo<float>::i'
g++-4.0.3-ice.cc:13: instantiated from here
g++-4.0.3-ice.cc:13: internal compiler error: in instantiate_decl, at cp/pt.c:11539
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.0/README.Bugs>.
~ % g++ --version
g++ (GCC) 4.0.3 20060304 (prerelease) (Debian 4.0.2-10)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(Same result with -O1, -O2 and -O3.)
g++-2.95, g++-3.3 and g++-3.4 don't exhibit an internal compiler error
-- they all exit with a (valid) error message.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-686-smp
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages g++-4.0 depends on:
ii gcc-4.0 4.0.2-10 The GNU C compiler
ii gcc-4.0-base 4.0.2-10 The GNU Compiler Collection (base
ii libc6 2.3.6-3 GNU C Library: Shared libraries an
ii libstdc++6-4.0-dev 4.0.2-10 The GNU Standard C++ Library v3 (d
g++-4.0 recommends no packages.
-- no debconf information
template <typename T>
struct foo
{
static const int i;
};
template <typename T>
const int foo<float>::i = 42;
int
main ()
{
return foo<float>::i;
}
# 1 "g++-4.0.3-ice.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "g++-4.0.3-ice.cc"
template <typename T>
struct foo
{
static const int i;
};
template <typename T>
const int foo<float>::i = 42;
int
main ()
{
return foo<float>::i;
}
Reply to: