Bug 22561 – only().joiner fails with immutable element type

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-12-03T10:04:35Z
Last change time
2021-12-06T20:00:37Z
Keywords
pull
Assigned to
No Owner
Creator
FeepingCreature

Comments

Comment #0 by default_357-line — 2021-12-03T10:04:35Z
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
Comment #1 by dlang-bot — 2021-12-03T11:54:54Z
@FeepingCreature created dlang/phobos pull request #8326 "Fix issue 22561: Allow joiner to reassign range values that contain mutable fields." fixing this issue: - Fix issue 22561: Allow joiner to reassign range values that contain mutable fields. https://github.com/dlang/phobos/pull/8326
Comment #2 by dlang-bot — 2021-12-06T20:00:37Z
dlang/phobos pull request #8326 "Fix issue 22561: Allow joiner to reassign range values that contain immutable fields." was merged into master: - 0a228d72a855e3d39be8004d613e291b53037039 by Mathis Beer: Fix issue 22561: Allow joiner to reassign range values that contain immutable fields. https://github.com/dlang/phobos/pull/8326