[Issue 18071] [REG2.078] byKey, byValue and byKeyValue are now a hole for unsafe code
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 13 15:41:02 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=18071
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |schveiguy at yahoo.com
--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Jack Stouffer from comment #1)
> The first example can be fixed by having `byValue.front` and
> `byValue.popFront` do this at the beginning of the function:
>
> if (this.empty)
> assert(0, "accessing front on an empty byValue");
This will have the same effect, as druntime is compiled in release mode.
Note that the first example isn't actually unsafe. It's simply dereferencing a
null pointer (which is fine in @safe code).
I have a PR in progress to fix the second problem. I'm not loving how it's
working out, but I am not sure exactly how to do it in a correct way (will post
something about it on the newsgroup).
--
More information about the Digitalmars-d-bugs
mailing list