Bug 1813 – static function parametrized with alias used with delegate throws an internal compiler error.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2008-02-01T10:22:00Z
Last change time
2015-06-09T05:14:54Z
Keywords
ice-on-invalid-code
Assigned to
ibuclaw
Creator
leandro.lucarella
Comments
Comment #0 by leandro.lucarella — 2008-02-01T10:22:07Z
When compiling this code:
-------->8------->8---- thunk.d ---->8-------->8--------
import std.stdio;
static void thunk(alias Fn)(void* arg)
{
Fn(arg);
}
void main()
{
int x = 1;
void dcb(void* arg)
{
writefln("dcb: ", *cast (int*) arg, " = ", x);
}
thunk!(dcb)(&x);
}
-------->8------->8---- thunk.d ---->8-------->8--------
I have this error:
thunk.d: In function ‘thunk’:
thunk.d:11: internal compiler error: in estimate_num_insns_1, at tree-inline.c:1902
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
With DMD I get this:
thunk.d(22): function thunk.main.dcb is a nested function and cannot be accessed from thunk
(If I remove the static to the function thunk it compiles OK on both compilers)
$ gdc --version
gdc (GCC) 4.1.3 20080114 (prerelease gdc 0.25 20071124, using dmd 1.022) (Debian 0.25-4.1.2-19)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.