August 16, 2021 [Issue 22215] New: [dip1000] scope analysis does not respect @system or @trusted | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22215 Issue ID: 22215 Summary: [dip1000] scope analysis does not respect @system or @trusted Product: D Version: D2 Hardware: x86 OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: Ajieskola@gmail.com This does not compile with -dip1000: ``` int* f() { int x = 42; return &x; } ``` There is a workaround that compiles: ``` int* f() { int x = 42; auto wannaBePointer = cast(size_t)&x; return cast(typeof(return)) wannaBePointer; } ``` But according to the spec, only `@safe` code must analyzed with -dip1000 so this workaround should not be required. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply