[Issue 1813] New: static function parametrized with alias used with delegate throws an internal compiler error.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 1 08:22:09 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1813

           Summary: static function parametrized with alias used with
                    delegate throws an internal compiler error.
           Product: DGCC aka GDC
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn at users.sf.net
        ReportedBy: llucax at gmail.com


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.


-- 



More information about the D.gnu mailing list