[Issue 23242] New: InputRangeObject derived from RandomAccessInfinite is not a random-access range
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 13 01:40:12 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23242
Issue ID: 23242
Summary: InputRangeObject derived from RandomAccessInfinite is
not a random-access range
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: snarwin+bugzilla at gmail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list