digitalmars.D.bugs - [Issue 18071] New: [REG2.078] byKey, byValue and byKeyValue are now
- d-bugmail puremagic.com (38/38) Dec 13 2017 https://issues.dlang.org/show_bug.cgi?id=18071
https://issues.dlang.org/show_bug.cgi?id=18071 Issue ID: 18071 Summary: [REG2.078] byKey, byValue and byKeyValue are now a hole for unsafe code Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: regression Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: greensunny12 gmail.com ``` int main() safe { auto a = ["foo": 1]; auto r = a.byValue; r.popFront; return r.front; // oops } ``` and another one: ``` struct Foo { int[int] aa; auto opCast() pure nothrow nogc { *cast(uint*)0xdeadbeef = 0xcafebabe; return null; } alias aa this; } int main() safe { Foo f; return !f.byKey.empty; } ``` While 2.077.1 correctly emits warnings that this isn't ` safe`, the code (after https://github.com/dlang/druntime/pull/1944) segfaults. --
Dec 13 2017