www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21831] New: Wrong deprecation message in template parameters

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

          Issue ID: 21831
           Summary: Wrong deprecation message in template parameters
                    before evaluating constraints
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

deprecated struct OldStruct { }

struct NewStruct { }

auto foo(T)(T t)    // error: struct `OldStruct` is deprecated
if (!__traits(isDeprecated, T))
{
    return T.init;
}

deprecated auto foo(T)(T t)
if (__traits(isDeprecated, T))
{
    return T.init;
}

deprecated unittest
{
    auto b = foo(OldStruct()); // instantiated from here
}

--
Apr 15 2021