March 04, 2020 [Issue 20634] New: @safe forces bounds checking on newly allocated array when using .ptr | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20634 Issue ID: 20634 Summary: @safe forces bounds checking on newly allocated array when using .ptr Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Keywords: rejects-valid Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: pro.mathias.lang@gmail.com ``` void main () @safe { auto ptr = [ 42 ].ptr; } ``` This errors out, even tho it is perfectly @safe. ``` foo.d(3): Error: [42].ptr cannot be used in @safe code, use &[42][0] instead ``` DMD v2.090.1 -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply