[Issue 22306] New: scope array variable should be stack allocated
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 14 16:03:04 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22306
Issue ID: 22306
Summary: scope array variable should be stack allocated
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dkorpel at live.nl
While this @nogc code currently gives an error, the array could be allocated on
the stack:
```
void main() @nogc {
scope int[] a = new int[10];
scope int[] a = [1, 2, 3];
}
```
It's already done for `scope` classes and array literals passed to scope
parameters. It has been brought up before
(https://github.com/dlang/dmd/pull/11039#issuecomment-613518685) but I don't
see a bugzilla issue for it yet.
--
More information about the Digitalmars-d-bugs
mailing list