The following code snippet crashes GCC 4.1.1 and 4.2.0 20060820 (experimental): ------ template<typename T> void f(T& r) { T a = r; }
void g() { f(g); } ------ Saving the code in a file a.cc and executing "c++ -c a.cc" produces: ------ a.cc: In function 'void f(T&) [with T = void ()()]': a.cc:9: instantiated from here a.cc:4: internal compiler error: in digest_init, at cp/typeck2.c:709 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. ------ The above output is produced by GCC 4.1.1. With the mentioned GCC CVS snapshot the linenumber where the ICE is reported changes to cp/typeck2.c:718. This bug might be related to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27807. GCC 3.4.6 does not ICE, and rejects the code with a diagnostic, which is correct behaviour as far as I know. -- Summary: Internal compiler error (ICE) when trying to initialize function in template Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vlukas at gmx dot de GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28787