On Friday, 5 June 2015 at 03:07:53 UTC, Yuxuan Shui wrote:
I tried something like this:

foreach(e; scoped!SomeRangeType(args)) {
}

And my program segment faults. But this works:

{
    auto x = scoped!SomeRangeType(args);
    foreach(e; x) {
    }
}

Shouldn't the range be alive until the end of the loop?

It should. Which compiler version are you using? I remember there recently was a bugfix for a very similar bug, it might not have been released yet. Can you please either test with DMD from Git (you'd need to build it yourself), or provide a minimal testcase so I can test it for you?

Reply via email to