[Issue 14653] scoped!range in foreach crashes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 17 06:20:47 PDT 2015


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

--- Comment #5 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
p.s. seems that what triggers the bug is `alias this` in wrapper. removing
`alias this` and rewriting wrapper to do simple redirections emits the correct
output.

i.e. changing `Wrapper` struct to the following one makes the bug go away:

  static struct Wrapper {
    SomeRangeType rng;
    //alias rng this;
    @property int front () { return rng.front; }
    void popFront () { rng.popFront; }
    @property bool empty () { return rng.empty; }
    @disable this (this);
    ~this () { writeln("wrapper dtor"); }
  }

--


More information about the Digitalmars-d-bugs mailing list