[Issue 20033] New: Deprecation not triggered with foreach + alias this

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 7 04:00:13 UTC 2019


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

          Issue ID: 20033
           Summary: Deprecation not triggered with foreach + alias this
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: pro.mathias.lang at gmail.com

```
struct Test {
    import std.typecons : Tuple;
    alias KVT = Tuple!(string, "key", string, "value");

    struct Range {
        bool empty () { return false; }
        KVT front() { return KVT.init; }
        void popFront() {}
    }

    auto byKeyValue () { return Range.init; }

    deprecated("This was a bad idea")
    alias byKeyValue this;
}

void main ()
{
    foreach (k, v; Test.init)
    {
    }
}
```

I expect `dmd -de test.d` to error out,  but no message is triggered.

--


More information about the Digitalmars-d-bugs mailing list