You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-----
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
The text was updated successfully, but these errors were encountered:
bugzilla (@WalterBright) commented on 2019-12-03T10:09:45Z
I think, the bug is to be found in dmd and byKey is innocent. If not, the correct component is not phobos but druntime, because byKey is located there.
andrej.mitrovich (@AndrejMitrovic) commented on 2022-07-07T13:25:29Z
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'.
Andrej Mitrovic (@AndrejMitrovic) reported this on 2019-10-02T02:07:19Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=20258
CC List
Description
The text was updated successfully, but these errors were encountered: