www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 users.sf.net
        ReportedBy: llucax 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.


-- 
Feb 01 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1813





------- Comment #1 from thomas-dloop kuehne.cn  2008-02-25 05:02 -------
Added to DStress as
http://dstress.kuehne.cn/run/b/bug_tree_inline_1902_A.d
http://dstress.kuehne.cn/nocompile/b/bug_tree_inline_1902_A.d


-- 
Feb 25 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1813





------- Comment #2 from llucax gmail.com  2008-02-25 06:20 -------
Thank you!


-- 
Feb 25 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1813


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #3 from Iain Buclaw <ibuclaw ubuntu.com> 2010-08-23 13:38:00 PDT ---
Fixed in hg commit 212 / release 0.25.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 23 2010