Bug 20175 – Nullable!T.get(x) immutable array elements downgraded to const

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-08-27T22:16:12Z
Last change time
2024-02-06T10:46:45Z
Assigned to
No Owner
Creator
elpenguino+D

Comments

Comment #0 by elpenguino+D — 2019-08-27T22:16:12Z
``` import std.typecons : Nullable; Nullable!string x; static assert(is(typeof(x.get()) == string)); //OK! static assert(is(typeof(x.get("")) == string)); //UH OH ``` We get const(char)[] instead of the expected string.
Comment #1 by issues.dlang — 2024-02-06T10:46:45Z
I don't know when this was fixed, but it works with dmd v2.107.0.