← Back to index
|
Original Bugzilla link
Bug 22002 – std.algorithm.each breaks when used with InputRangeObject
Status
NEW
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-06-07T18:11:16Z
Last change time
2024-12-13T19:16:50Z
Assigned to
No Owner
Creator
mipri
Moved to GitHub: dmd#19940 →
Comments
Comment #0
by mipri — 2021-06-07T18:11:16Z
The following complete example unittest { import std.algorithm : each; import std.range : only, inputRangeObject; import std.stdio : writeln; only(1, 2).inputRangeObject.each!writeln; } Fails with this error: each.d(6): Error: `std.algorithm.iteration.each!(writeln).each` called with argument types `(InputRangeObject!(OnlyResult!(int, int)))` matches both: phobos/std/algorithm/iteration.d(953): `std.algorithm.iteration.each!(writeln).each!(InputRangeObject!(OnlyResult!(int, int))).each(InputRangeObject!(OnlyResult!(int, int)) r)` and: phobos/std/algorithm/iteration.d(1014): `std.algorithm.iteration.each!(writeln).each!(InputRangeObject!(OnlyResult!(int, int))).each(InputRangeObject!(OnlyResult!(int, int)) r)` With DMD64 D Compiler v2.097.0
Comment #1
by mipri — 2021-09-18T07:38:31Z
workaround: auto noapply(T)(T x) { import std.range.primitives : ElementType; struct NoApply(T) { T wrapped; alias wrapped this; @disable ElementType!T opApply(); } return NoApply!T(x); } unittest { import std.algorithm : each; import std.range : only, inputRangeObject; import std.stdio : writeln; only(1, 2).inputRangeObject.noapply.each!writeln; }
Comment #2
by robert.schadek — 2024-12-13T19:16:50Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/19940
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB