[Issue 8999] New: Closure not detected for reference paramters of templated functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 12 01:22:01 PST 2012
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 at puremagic.com
ReportedBy: verylonglogin.reg at gmail.com
Blocks: 2573
--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2012-11-12 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: -------
More information about the Digitalmars-d-bugs
mailing list