[Issue 20888] New: std.range.Cycle does not compose with `const`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun May 31 08:59:58 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20888
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 at puremagic.com
Reporter: pro.mathias.lang at 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;
writeln(d.get().take(10));
}
```
Expectation: 10 characters get printed
Reality:
```
/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
Cycle!(char[4096])
foo.d(14): Error: template instance std.range.take!(const(Cycle!(char[4096])))
error instantiating
```
--
More information about the Digitalmars-d-bugs
mailing list