www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21830] New: Wrong deprecation message when non-deprecated

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

          Issue ID: 21830
           Summary: Wrong deprecation message when non-deprecated function
                    in static condition
           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 { }

static if (1)
{
    auto getInit(T)(T t)
    if (is(T == NewStruct))
    {
        return T.init;
    }
}

deprecated("Using deprecated overload")
auto getInit(T)(T t)
if (is(T == OldStruct))
{
    return T.init;
}

unittest
{
    auto b = getInit(NewStruct()); // error here about using getInit!OldStruct
}

--
Apr 15