www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18755] New: std.typecons.Rebindable breaks safe-ty

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

          Issue ID: 18755
           Summary: std.typecons.Rebindable breaks  safe-ty
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: safe
          Severity: critical
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: code klickverbot.at

This compiles and runs with DMD 2.079:

---
class Foo {
    auto opCast(T)()  system immutable pure nothrow {
        *(cast(uint*)0xdeadbeef) = 0xcafebabe;
        return T.init;
    }
}

void main()  safe {
    import std.typecons;
    auto r = Rebindable!(immutable Foo)(new Foo); // oops
}
---

--
Apr 11 2018