www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20888] New: std.range.Cycle does not compose with `const`


          Issue ID: 20888
           Summary: std.range.Cycle does not compose with `const`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

import std.stdio;
import std.range;

struct Data
    char[4096] internal;
    Cycle!(char[4096]) cycle;
    auto get () const { return this.cycle.save(); }

void main ()
    Data d;

Expectation: 10 characters get printed
/usr/local/opt/dmd/include/dlang/dmd/std/range/package.d(2231): Error: cannot
implicitly convert expression input of type const(Cycle!(char[4096])) to
foo.d(14): Error: template instance std.range.take!(const(Cycle!(char[4096])))
error instantiating

May 31 2020