[Issue 24801] New: `RefRange` doesn’t work if range primitives are not `const`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 9 12:12:53 UTC 2024
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 at puremagic.com
Reporter: ogion.art at 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
--
More information about the Digitalmars-d-bugs
mailing list