https://issues.dlang.org/show_bug.cgi?id=22561

          Issue ID: 22561
           Summary: only().joiner fails with immutable element type
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: [email protected]
          Reporter: [email protected]

import std;

immutable struct Foo {
    int[] r;
}

void main() { 
    auto foo = [5].map!(a => only(Foo(null))).joiner;
}

expected: compiles
got: flood of errors

/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d-mixin-3601(3616):
Error: cannot modify struct instance `this._current` of type
`OnlyResult!(immutable(Foo))` because it contains `const` or `immutable`
members

--

Reply via email to