Bug 12822 – Delegate .ptr assignment considered @safe

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-30T12:40:00Z
Last change time
2016-10-01T11:47:37Z
Keywords
accepts-invalid, pull, safe
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2014-05-30T12:40:48Z
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.
Comment #1 by bugzilla — 2016-06-08T04:33:48Z
Comment #2 by github-bugzilla — 2016-06-12T07:58:02Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/51143be746a36c43bc6c25f85648b13dc57e5585 fix Issue 12822 - Delegate .ptr assignment considered @safe https://github.com/dlang/dmd/commit/0f2c901890e04699bf5a151a992b5eecf8d0cfde Merge pull request #5851 from WalterBright/fix12822 fix Issue 12822 - Delegate .ptr assignment considered @safe
Comment #3 by github-bugzilla — 2016-06-13T20:29:33Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/73301fec8727569aedd6f9f94a2217a38a525d24 Actually test compiler output for issue 12822 This is a fix-up for pull #5851. https://github.com/dlang/dmd/commit/f7d88d54d8f499ed05a9ecd3b28c819c8ecdf8bb Merge pull request #5865 from denis-sh/patch-2 Actually test compiler output for issue 12822
Comment #4 by github-bugzilla — 2016-10-01T11:47:37Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/51143be746a36c43bc6c25f85648b13dc57e5585 fix Issue 12822 - Delegate .ptr assignment considered @safe https://github.com/dlang/dmd/commit/0f2c901890e04699bf5a151a992b5eecf8d0cfde Merge pull request #5851 from WalterBright/fix12822 https://github.com/dlang/dmd/commit/73301fec8727569aedd6f9f94a2217a38a525d24 Actually test compiler output for issue 12822 https://github.com/dlang/dmd/commit/f7d88d54d8f499ed05a9ecd3b28c819c8ecdf8bb Merge pull request #5865 from denis-sh/patch-2