September 07 [Issue 24750] New: escaping sliced stack arrays not detected | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24750 Issue ID: 24750 Summary: escaping sliced stack arrays not detected Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: bugzilla@digitalmars.com Jonathan Davis reports: int[] foo() { int[3] arr = [1,2,3]; return arr[]; // returning `arr[]` escapes a reference to local variable `arr` } whereas: int[] foo() { int[3] arr = [1,2,3]; int[] slice = arr[]; return slice; } compiles without complaint. -- |
Copyright © 1999-2021 by the D Language Foundation