https://d.puremagic.com/issues/show_bug.cgi?id=11602
Summary: `delegate`s passed with `in` direction causes closures
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: performance
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Denis Shelomovskij <[email protected]> 2013-11-25
18:38:51 MSK ---
According to specs "`in` equivalent to `const scope`" but the following code
allocates a closure:
---
import std.stdio;
// change direction to `scope` to leave `i` on stack
void f(in void delegate() del)
{ del(); }
void main()
{
int i, j;
writeln(&j); // show stack address
f(() => writeln(&i)); // `i` is on heap
}
---
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------