This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/28787] Internal compiler error (ICE) when trying to initialize function in template
- From: "vlukas at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Aug 2006 12:04:08 -0000
- Subject: [Bug c++/28787] Internal compiler error (ICE) when trying to initialize function in template
- References: <bug-28787-3376@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from vlukas at gmx dot de 2006-08-21 12:04 -------
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?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28787