May 05, 2017 [Issue 17370] New: [DIP1000] Escaping scope pointers possible via struct GC allocation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17370 Issue ID: 17370 Summary: [DIP1000] Escaping scope pointers possible via struct GC allocation Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: safe Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: mathias.lang@sociomantic.com The following compiles and runs with 2.074.0 and v2.075.0-devel-5cfc8d982 (latest master): ``` void main () @safe { int* ptr = fwd(); assert(ptr !is null); } int* fwd () @safe { int i; return new Struct(&i).oops; // Leaving out `new` correctly detects escaping } struct Struct { int* oops; } ``` -- |
Copyright © 1999-2021 by the D Language Foundation