From mboxrd@z Thu Jan 1 00:00:00 1970 From: Morten Nicolaj Pedersen To: egcs-bugs@egcs.cygnus.com Subject: Bug report Date: Wed, 31 Mar 1999 23:54:00 -0000 Message-id: X-SW-Source: 1999-03n/msg00428.html List-Id: Att. developers/maintainers I am using egcs version 1.1.1 which I have built myself on my Pentium desktop PC / Redhat Linux 5.2 system (I gave no options to 'configure'). When trying to compile 'Sparse_table.cpp' with options '-c -g -O' (or with no options at all) I get the following: ************************************************************************ cd ~/documents/speciale/src/alpha/ make Sparse_table.o g++ -c -g -O -I/home/mortennp/documents/speciale/src/download/randgen -I/home/mortennp/documents/speciale/src/download/newran02 Sparse_table.cpp -o Sparse_table.o Sparse_table.h: In method `::Sparse_table::::Sparse_table::Hash_func::Hash_func(short unsigned int = (8 * sizeof (Key)), unsigned char = 16)': Sparse_table.cpp:102: instantiated from here Sparse_table.h:86: Internal compiler error 980519. Sparse_table.h:86: Please submit a full bug report to `egcs-bugs@cygnus.com'. Sparse_table.h:86: See for details. make: *** [Sparse_table.o] Error 1 Compilation exited abnormally with code 2 at Tue Mar 9 12:10:33 ************************************************************************ It is my instantiation of (for instance) 'Hash_func' which causes problems. If I remove all the explicit instantiations, the code compiles with no errors. I get the same kind of error, if I try to use/implicitly instantiate (for instance) 'Hash_func' from a file, which '#include's 'Sparse_table.h'. What gives? Am I missing something? I have read the .info-file on gcc/g++/egcs rather thoroughly, giving special attention to the section on template instantiation. Apologies in advance, if I am simply bothering you due to lack of understanding. I have placed a copy of 'Sparse_table.ii', which results from compiling with '-E -C' on my homepage. The URL is: http://www.diku.dk/students/forge/Sparse_table.tar.gz I think I have obeyed the bug reporting instructions. Let me know if I forgot to detail anything important. Regards Morten Nicolaj Pedersen E-address: forge@diku.dk Department of Computer Science, University of Copenhagen >>From Gabriel.Dos-Reis@dptmaths.ens-cachan.fr Wed Mar 31 23:54:00 1999 From: Gabriel Dos Reis To: Victor Bazarov Cc: "'egcs-bugs@cygnus.com'" Subject: Re: EGCS asked for it Date: Wed, 31 Mar 1999 23:54:00 -0000 Message-id: References: <4D0C1E192CE9D1119A6C00805FC1F8FAE27C0F@EXCHANGE> X-SW-Source: 1999-03n/msg00290.html Content-length: 863 >>>>> Victor Bazarov wrote: > While compiling this text: > ========================================== > template T factorial() > { > return factorial() * T(n); > } > template T factorial() > { // this is line 7 > return T(2); > } > int main() > { > int a = factorial(); > } > ========================================== > I get > templ.cpp:7: Internal compiler error. > templ.cpp:7: Please submit a full bug report to `egcs-bugs@cygnus.com'. > Line 7 is marked. > g++ --version yields: egcs-2.90.29 980515 (egcs-1.0.3 release) > I suspect I am doing something wrong. Please help me figure out what. You are defining the same template function twice. I guess you're attempting to do partial specialization on a template function. There is no such concept. -- Gaby