www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17211] New: deprecated is not consistently allowed on local

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 puremagic.com
          Reporter: issues.dlang 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,
    }
}


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.

--
Feb 20 2017