Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RefRange doesn’t work if range primitives are not const #10562

Open
dlangBugzillaToGithub opened this issue Oct 9, 2024 · 1 comment
Open

Comments

@dlangBugzillaToGithub
Copy link

ogion.art reported this on 2024-10-09T12:12:53Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=24801

Description

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
@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2024-10-09T12:30:19Z

@Ogi-kun updated dlang/phobos pull request #9056 "Fix issue 24801 - `RefRange` doesn’t work if range primitives are not `const`" fixing this issue:

- Fix Bugzilla issue 24801 - `RefRange` doesn’t work if range primitives are not `const`

https://github.com/dlang/phobos/pull/9056

@LightBender LightBender removed the P1 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants