Bug 18505 – delete deprecation message is misleading

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-02-23T14:44:23Z
Last change time
2018-02-24T10:08:54Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Steven Schveighoffer

Comments

Comment #0 by schveiguy — 2018-02-23T14:44:23Z
Currently, the dprecation message for delete says: Deprecation: The delete keyword has been deprecated. Use object.destroy() instead. However, this is not complete. In order to fully replace the mechanism of delete, you must call GC.free on the pointer. In many cases, people have used delete and expect the memory to be freed. Telling them that all they have to do is use destroy is not going to satisfy. I suggest (similar to Bearophile's suggestion in issue 9433): use object.destroy (and optionally core.memory.GC.free) instead. There is also this new function (unreleased as of 2.079, but in druntime already): https://dlang.org/phobos-prerelease/core_memory.html#.__delete
Comment #1 by github-bugzilla — 2018-02-24T10:08:53Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/db25160a7eeedb052cf6f2ed8de042cf129ebeeb Fix Issue 18505 - delete deprecation message is misleading https://github.com/dlang/dmd/commit/1834d62badb02c5f67d6d39e93c90e30df8412fc Merge pull request #7947 from JinShil/fix_18505 Fix Issue 18505 - delete deprecation message is misleading