[Issue 13536] New: Union of delegates breaks @safety

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Sep 26 18:41:47 PDT 2014


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

          Issue ID: 13536
           Summary: Union of delegates breaks @safety
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: hsteoh at quickfur.ath.cx

------
struct S {
        void sysMethod() @system {}
}
void fun() @safe {
        union U {
                void delegate() @system sysDg;
                void delegate() @safe safeDg;
        }
        U u;
        S s;
        u.sysDg = &s.sysMethod;
        // s.sysMethod(); // the compiler catches this
        u.safeDg(); // but not this
}
------

--


More information about the Digitalmars-d-bugs mailing list