October 09 [Issue 24801] New: `RefRange` doesn’t work if range primitives are not `const` | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24801 Issue ID: 24801 Summary: `RefRange` doesn’t work if range primitives are not `const` Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: ogion.art@gmail.com import std.range; unittest { static struct R { int front() => 0; void popFront() {} bool empty() => false; } R range; auto r = RefRange!R(&range); } src/phobos/std/range/package.d(12407): Error: mutable method `onlineapp.__unittest_L3_C1.R.front` is not callable using a `const` object app.d(6): Consider adding `const` or `inout` here src/phobos/std/range/package.d(12433): Error: mutable method `onlineapp.__unittest_L3_C1.R.empty` is not callable using a `const` object app.d(8): Consider adding `const` or `inout` here app.d(11): Error: template instance `std.range.RefRange!(R)` error instantiating -- |
Copyright © 1999-2021 by the D Language Foundation