[Issue 20258] New: alias this produces an infinite range when used with hashmaps

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 2 02:07:19 UTC 2019


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

          Issue ID: 20258
           Summary: alias this produces an infinite range when used with
                    hashmaps
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com

-----
import std.stdio;

struct Set
{
    int[int] set;
    auto walk () { return this.set.byKey(); }
    alias walk this;
}

void main()
{
    Set set;
    set.set[1] = 10;
    writefln("Set contents: %s", set.set.byKey());  // ok
    writefln("Set contents: %s", set);  // prints "1" infinitely
}
-----

Tested with v2.086.1 and v2.088.0

--


More information about the Digitalmars-d-bugs mailing list