https://issues.dlang.org/show_bug.cgi?id=20722

--- Comment #2 from Mathias LANG <[email protected]> ---
Not quite. It's true the `null` pointers are not considered unsafe, otherwise
we wouldn't be able to dereference anything in `@safe` code.

But one of the guarantee that `@safe` code offers is that you cannot create an
invalid, non null pointer. That's why, for example, you can't do `arr.ptr`, but
you can do `&arr[idx].ptr`.

And if you do:
```
    const void* ptr = &typeid(int).initializer()[$-1];
    assert(ptr !is null);
    writeln(ptr);
```

You create a pointer with value `0x3`, which breaks `@safe`.

--

Reply via email to