[Issue 20258] alias this produces an infinite range when used with ranges
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jul 7 13:25:29 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=20258
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|alias this produces an |alias this produces an
|infinite range when used |infinite range when used
|with hashmaps |with ranges
--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
Simpler example:
-----
import std.stdio;
import std.range;
struct Set
{
auto walk () { return [].only; }
alias walk this;
}
void main()
{
Set set;
writeln(set);
}
-----
It has to do with ranges, not specifically hashmaps as previously thought.
I think somewhere in the formatter it's probably trying to invoke walk()
multiple times, implicitly through that 'alias this'.
--
More information about the Digitalmars-d-bugs
mailing list