[Issue 20236] New: spurious deprecation warnings on function calls within with(X) blocks while X has a deprecated alias this target

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 22 02:25:05 UTC 2019


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

          Issue ID: 20236
           Summary: spurious deprecation warnings on function calls within
                    with(X) blocks while X has a deprecated alias this
                    target
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: elpenguino+D at gmail.com

```
struct X {
    alias y this;
    deprecated int y() { return 5; }
    int x() { return 5; }
}
unittest {
    static void func(int) {}
    with(X.init) {
        func(x);
    }
}
```

Since DMD 2.064, this code prints a deprecation warning despite y() never being
called or otherwise used.

--


More information about the Digitalmars-d-bugs mailing list