Comment #0 by moonlightsentinel — 2020-06-28T17:16:00Z
The following code compiles without raising an error regarding `arr.ptr`.
void main() @safe
{
uint[] arr = [1, 2, 3];
bool b = !arr.ptr;
}
Comment #1 by moonlightsentinel — 2020-06-28T19:53:01Z
Checking array.ptr is @safe as long as it isn't dereferenced
Comment #2 by hsteoh — 2020-07-13T17:38:33Z
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*.