[Issue 18071] New: [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 08:52:30 UTC 2017
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 at puremagic.com
Reporter: greensunny12 at 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.
--
More information about the Digitalmars-d-bugs
mailing list