www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20221] New: __traits(isDeprecated) returns false on

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

          Issue ID: 20221
           Summary: __traits(isDeprecated) returns false on deprecated
                    aliases
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zorael gmail.com

Manjaro/Arch x86_64, dmd v2.087.1, ldc v1.16.0.

__traits(isDeprecated, deprecatedAlias) evaluates whether the aliased symbol is
deprecated, not whether the alias is.

struct Foo
{
    string good;
    deprecated alias bad = good;
}

void main()
{
    Foo f;
    string good = f.bad;
    static assert(__traits(isDeprecated, f.bad));
}

onlineapp.d(10): Deprecation: alias `onlineapp.Foo.bad` is deprecated
onlineapp.d(11): Error: static assert:  __traits(isDeprecated, good) is false

https://run.dlang.io/is/tLS1o2

--
Sep 17 2019