Bug 11602 – `delegate`s passed with `in` direction causes closures

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-25T06:38:51Z
Last change time
2024-12-13T18:14:21Z
Keywords
performance
Assigned to
No Owner
Creator
Denis Shelomovskii
Moved to GitHub: dmd#18720 →

Comments

Comment #0 by verylonglogin.reg — 2013-11-25T06:38:51Z
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 } ---
Comment #1 by robert.schadek — 2024-12-13T18:14:21Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18720 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB