digitalmars.D.bugs - [Issue 12822] New: Delegate .ptr assignment considered safe
- via Digitalmars-d-bugs (27/27) May 30 2014 https://issues.dlang.org/show_bug.cgi?id=12822
https://issues.dlang.org/show_bug.cgi?id=12822 Issue ID: 12822 Summary: Delegate .ptr assignment considered safe Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: critical Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: code klickverbot.at DMD 2.065 (same for current Git master, 4fbe9f4) accepts the following, obviously unsafe code: --- class C { int a; int func() { return a; } } safe void test() { auto c = new C(); auto dg = &c.func; dg.ptr = new long; dg(); } --- .ptr/.funcptr cannot be assigned safely, as the type system does not model the context pointer type. --
May 30 2014