This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13289] New: internal compiler error : regenerate_decl_from_template, at cp/pt.c:10131
- From: "gianni at mariani dot ws" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Dec 2003 23:50:44 -0000
- Subject: [Bug c++/13289] New: internal compiler error : regenerate_decl_from_template, at cp/pt.c:10131
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I can understand why this code has problems - it is recursive, I need to find a
way to make it not be so ! But the compiler spits out an "internal compiler
error" that probably needs a look at.
template <typename T, T N>
struct bit_count_templ
{
static const T bit_count;
};
template <typename T, T N>
const T bit_count_templ<T,N>::bit_count = 1 + ( N == 0 ? 0 : bit_count_templ<T,
N & ( N -1 ) >::bit_count );
#include <iostream>
int main()
{
std::cout << bit_count_templ<long,0x256500LL>::bit_count;
}
g++ -Wreturn-type -W -Wpointer-arith -pipe -ggdb3 -fcheck-new -fPIC
-D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT templ_bitcount.cpp
-o templ_bitcount
templ_bitcount.cpp: In instantiation of `const long int bit_count_templ<long
int, 0>::bit_count':
templ_bitcount.cpp:10: instantiated from `const long int bit_count_templ<long
int, 0>::bit_count'
templ_bitcount.cpp:10: instantiated from `const long int bit_count_templ<long
int, 2097152>::bit_count'
templ_bitcount.cpp:10: instantiated from `const long int bit_count_templ<long
int, 2359296>::bit_count'
templ_bitcount.cpp:10: instantiated from `const long int bit_count_templ<long
int, 2424832>::bit_count'
templ_bitcount.cpp:10: instantiated from `const long int bit_count_templ<long
int, 2441216>::bit_count'
templ_bitcount.cpp:10: instantiated from `const long int bit_count_templ<long
int, 2449408>::bit_count'
templ_bitcount.cpp:10: instantiated from `const long int bit_count_templ<long
int, 2450432>::bit_count'
templ_bitcount.cpp:10: instantiated from `const long int bit_count_templ<long
int, 2450688>::bit_count'
templ_bitcount.cpp:17: instantiated from here
templ_bitcount.cpp:10: internal compiler error: in
regenerate_decl_from_template, at cp/pt.c:10131
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
--
Summary: internal compiler error : regenerate_decl_from_template,
at cp/pt.c:10131
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gianni at mariani dot ws
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13289