www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8999] New: Closure not detected for reference paramters of templated functions

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8999

           Summary: Closure not detected for reference paramters of
                    templated functions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com
            Blocks: 2573



12:21:58 MSK ---
In the following example closure isn't detected:
---
import std.stdio;

void copyDel()(out void delegate() dest, void delegate() src)
{ dest = src; }

void g(out void delegate() del)
{
    int i;
    void f() { writefln("&i: %X (should be in heap)", &i); }
    copyDel(del, &f);
}

void main()
{
    int j;
    writefln("A heap address:  %X", new int);
    writefln("A stack address: %X", &j);
    void delegate() del;
    g(del);
    del();
}
---

Output:
---
A heap address:  A01E70
A stack address: 12FE64
&i: 12FE50 (should be in heap)   <- not in heap
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8999


Denis Shelomovskij <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



12:25:49 MSK ---
*** Issue 6768 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012