www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics




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

↑ ↓ ← 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
→ 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
→ 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