Bug 19257 – std.array.join does not handle const fields that cannot be converted to mutable

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-09-21T09:43:27Z
Last change time
2018-10-02T23:06:41Z
Assigned to
No Owner
Creator
FeepingCreature

Comments

Comment #0 by default_357-line — 2018-09-21T09:43:27Z
std.array.join tries to remove constness from its arrays' fields on the premise that it's constructing a new array anyways. However, consider const(Object)[][].join: const(Object) cannot be implicitly converted to Object, so the join fails. In that case, join should just return a const(Object)[] array.
Comment #1 by default_357-line — 2018-09-21T09:44:15Z
Comment #2 by github-bugzilla — 2018-10-02T23:06:40Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/7a32298747de7e0b302d39f8c836eef84a9b9e8c Fix issue 19257: Only remove const on .join if you can actually assign const to non-const values. https://github.com/dlang/phobos/commit/0994f692e2f6c1a32249d2153778083d4bc3d947 Merge pull request #6711 from FeepingCreature/fix/join-unassignable-const-arrays Fix issue 19257: std.array.join: only remove const if you can actually assign const to non-const values merged-on-behalf-of: Nathan Sashihara <[email protected]>