June 02, 2014 [Issue 12822] New: Delegate .ptr assignment considered @safe | ||||
---|---|---|---|---|
| ||||
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. -- |
Copyright © 1999-2021 by the D Language Foundation