Bug 23242 – InputRangeObject derived from RandomAccessInfinite is not a random-access range

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-07-13T01:40:12Z
Last change time
2022-07-13T21:38:22Z
Assigned to
No Owner
Creator
Paul Backus
Depends on
23243

Comments

Comment #0 by snarwin+bugzilla — 2022-07-13T01:40:12Z
As of DMD 2.100.0, the following program fails to compile: --- import std.range; void main() { auto r = repeat(0).inputRangeObject; static assert(is(typeof(r) : RandomAccessInfinite!int)); // ok static assert(isRandomAccessRange!(typeof(r))); // fails } --- This happens because the InputRangeObject r does not have an .empty property that evaluates to false at compile time, as required by std.range.primitives.isInfinite. See also issue 22608.
Comment #1 by snarwin+bugzilla — 2022-07-13T02:11:15Z
Blocked by issue 23243. InputRangeObject's .empty property must be a member function in order to implement the InputRange interface, but isInfinite requires .empty to be a manifest constant.
Comment #2 by snarwin+bugzilla — 2022-07-13T21:38:22Z
Since issue 23423 cannot be fixed, neither can this one.