[Issue 17370] New: [DIP1000] Escaping scope pointers possible via struct GC allocation
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri May 5 01:33:00 PDT 2017
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 at puremagic.com
Reporter: mathias.lang at 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;
}
```
--
More information about the Digitalmars-d-bugs
mailing list