www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18859] New: Silence class allocator/deallocator deprecation

https://issues.dlang.org/show_bug.cgi?id=18859

          Issue ID: 18859
           Summary: Silence class allocator/deallocator deprecation
                    warning if they are marked "deprecated"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

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.

--
May 14 2018