Thread overview
[Issue 20988] Missing error for negated array.ptr
June 28, 2020
https://issues.dlang.org/show_bug.cgi?id=20988

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe

--
June 28, 2020
https://issues.dlang.org/show_bug.cgi?id=20988

--- Comment #1 from moonlightsentinel@disroot.org ---
Checking array.ptr is @safe as long as it isn't dereferenced

--
July 13, 2020
https://issues.dlang.org/show_bug.cgi?id=20988

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |hsteoh@quickfur.ath.cx
         Resolution|---                         |INVALID

--- Comment #2 from hsteoh@quickfur.ath.cx ---
There doesn't seem to be a real problem here?  `b` would just be set to true if arr.ptr is null, and false otherwise.

Accessing the value of a pointer is perfectly fine in @safe. Even deferencing a pointer is fine, since any pointer value constructed in a @safe manner would not point to something invalid.  What's not allowed in @safe is *pointer arithmetic*.

--