Bug 18859 – Silence class allocator/deallocator deprecation warning if they are marked "deprecated"
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-05-14T22:14:06Z
Last change time
2018-05-15T00:50:46Z
Keywords
pull
Assigned to
No Owner
Creator
Vladimir Panteleev
Comments
Comment #0 by dlang-bugzilla — 2018-05-14T22:14:06Z
To facilitate transition from class allocators/deallocators, it would be nice if it was possible to mark them as deprecated, which would move the deprecation warning from the declaration to any code that uses them. This would be similar to how deprecated unittests allow silently testing deprecated symbols.
Example:
////////////// test.d /////////////
class C
{
new(size_t sz) { return null; }
}
void fun()
{
new C;
}
///////////////////////////////////
Currently, this warns on line 3.
/////////////////// test.d ///////////////////
class C
{
deprecated new(size_t sz) { return null; }
}
void fun()
{
new C;
}
//////////////////////////////////////////////
This warns both on line 3 and line 8 (usage).
It would be better to just have a warning at line 8.
Comment #1 by dlang-bugzilla — 2018-05-14T22:45:25Z