[Issue 22608] New: RandomAccessInfinite is not a valid random-access range

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 19 00:07:35 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22608

          Issue ID: 22608
           Summary: RandomAccessInfinite is not a valid 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.098.0, the following program fails to compile:

---
import std.range.primitives: isRandomAccessRange;
import std.range.interfaces: RandomAccessInfinite;

static assert(isRandomAccessRange!(RandomAccessInfinite!int));
---

The error message is:

---
bug.d(4): Error: static assert: 
`isRandomAccessRange!(RandomAccessInfinite!int)` is false
---

The failure occurs because `isInfinite!(RandomAccessInfinite!int)` evaluates to
false, which happens because `RandomAccessInfinite!int.empty` cannot be
evaluated at compile time.

--


More information about the Digitalmars-d-bugs mailing list