[Issue 17211] New: deprecated is not consistently allowed on local declarations

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Feb 20 11:16:20 PST 2017


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

          Issue ID: 17211
           Summary: deprecated is not consistently allowed on local
                    declarations
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: issues.dlang at jmdavisProg.com

When deprecated is and isn't allowed on local declarations is not consistent.

compiles:

void main()
{
    deprecated class Foo
    {
    }
}

void main()
{
    deprecated void foo()
    {
    }
}

void main()
{
    deprecated int i;
}

does not compile:

void main()
{
    deprecated("Deprecated in Qt version 5.3") class Foo
    {
    }
}

void main()
{
    deprecated("Deprecated in Qt version 5.3") void foo()
    {
    }
}

void main()
{
    deprecated("Deprecated in Qt version 5.3") int i;
}

void main()
{
    deprecated enum Enum
    {
        a,
        b,
        c,
        d,
    }
}

void main()
{
    deprecated("Deprecated in Qt version 5.3")
    enum Enum
    {
        a,
        b,
        c,
        d,
    }
}

The fix for issue #11689 fixed at least some of the cases where deprecated
didn't work on local symbols, but either it didn't fix them all, or a change
since then broke some of them. In particular, deprecated on local enum
declarations doesn't work, and having a deprecation message on local
declarations never works.

Personally, I find this very annoying, because I'm trying to test code
generation by mixing the generated code into a unittest block, and that doesn't
consistently work right now if the local declaration is deprecated.

--


More information about the Digitalmars-d-bugs mailing list