www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22608] New: RandomAccessInfinite is not a valid random-access


          Issue ID: 22608
           Summary: RandomAccessInfinite is not a valid random-access
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla 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.

Dec 18 2021