[Issue 22561] New: only().joiner fails with immutable element type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 3 10:04:35 UTC 2021


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: nobody at puremagic.com
          Reporter: default_357-line at yahoo.de

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

--


More information about the Digitalmars-d-bugs mailing list