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.
Indeed a dup of that PR. *** This bug has been marked as a duplicate of 27807 ***
>Indeed a dup of that PR. > >*** This bug has been marked as a duplicate of 27807 *** I do not mean to sound impertinent, but with GCC 4.2.0 20060820 (experimental), I can not reproduce bug 27807. However the code I submitted still crashes this same version. Doesn't that mean the the fix for 27807 does not at the same time fix this?
A variation of the code crashes GCC 4.2.0 20060820 (experimental) with a different ICE: ------ template<typename> void f() { typedef void (t)(); t a = x; } void g() { f<int>(); } ------ This produces the following output: ------ b.cc: In function 'void f()': b.cc:5: error: function 'void a()' is initialized like a variable b.cc:5: error: 'x' was not declared in this scope b.cc:5: internal compiler error: tree check: expected var_decl, have function_decl in cp_finish_decl, at cp/decl.c:5089 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. ------ This latter snippet does not crash GCC 3.4.6 or 4.1.1. Should this rather get its own report?
(In reply to comment #3) > A variation of the code crashes GCC 4.2.0 20060820 (experimental) with a > different ICE: That is most likely PR 27961.