www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19936] New: Deprecated alias get this falsely triggers on

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

          Issue ID: 19936
           Summary: Deprecated alias get this falsely triggers on
                    appending to array
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Consider the following code:

struct Bla
{
    deprecated("bla")
    int get() { return 5; }

    alias get this;
}

void main()
{
    Bla[] blaArray;
    blaArray ~= Bla();
}

There is no reason that appending to Bla[] should justify an access to the
deprecated get() function. And yet, when compiled with `-de`, `blaArray ~=
Bla()` errors with a deprecation error. Note that this does not happen with
`blaArray ~ Bla()`.

--
Jun 03 2019