[Issue 23202] catch null dereferences at compille time
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 21 11:48:44 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23202
Dennis <dkorpel at live.nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dkorpel at live.nl
Hardware|x86_64 |All
Summary|assigning class.tupleof |catch null dereferences at
|with a string segfaults at |compille time
|runtime, also with @safe |
OS|Linux |All
Severity|normal |enhancement
--- Comment #1 from Dennis <dkorpel at live.nl> ---
S.init is `null`, which you dereference by accessing a member. `@safe` does not
prevent `null` dereferences, since those only abort the program, they don't
corrupt memory. The code is essentially doing this:
```
auto s = (cast(S)null).str;
```
Changing this to an enhancement.
--
More information about the Digitalmars-d-bugs
mailing list