D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8999 - Closure not detected for reference paramters of templated functions
Summary: Closure not detected for reference paramters of templated functions
Status: RESOLVED DUPLICATE of issue 9834
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: wrong-code
: 6768 (view as issue list)
Depends on:
Blocks: 2573
  Show dependency treegraph
 
Reported: 2012-11-12 01:21 UTC by Denis Shelomovskii
Modified: 2015-02-23 06:45 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Denis Shelomovskii 2012-11-12 01:21:58 UTC
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
---
Comment 1 Denis Shelomovskii 2012-11-12 01:25:49 UTC
*** Issue 6768 has been marked as a duplicate of this issue. ***
Comment 2 Kenji Hara 2015-02-23 06:45:05 UTC
Fixed in 2.063, because it's a dup of issue 9834.

*** This issue has been marked as a duplicate of issue 9834 ***