Bug 18051 – missing enum support in formattedRead/unformatValue

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-12-09T16:09:16Z
Last change time
2021-12-31T10:28:12Z
Keywords
pull
Assigned to
No Owner
Creator
Martin Nowak

Comments

Comment #0 by code — 2017-12-09T16:09:16Z
cat > enh.d << CODE import std.format; enum Op { lt, gt, eq } void main() { auto s = format!"%s"(Op.lt); Op op; formattedRead!"%s"(s, op); } CODE dmd -run enh.d ---- phobos/std/format.d(4872): Error: template std.format.unformatValueImpl cannot deduce function from argument types !(Op)(string, const(FormatSpec!char)) ... enh.d(7): instantiated from here: formattedRead!("%s", string, Op) ---- Formatting and unformatting should be symmetric, but currently (2.077.1) enums are not supported by unformatValue.
Comment #1 by github-bugzilla — 2018-08-21T11:27:36Z
Commit pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/6a0a91a8135cc0ce10253c23e788b0782bce165e Use version(TestComplex) as a workaround against issue 18051
Comment #2 by schveiguy — 2021-06-04T17:29:23Z
Just ran into this today (2.096.1). Surprised this isn't fixed yet...
Comment #3 by dlang-bot — 2021-12-29T23:46:48Z
@wolframw created dlang/phobos pull request #8345 "Fix Issue 18051 - missing enum support in formattedRead/unformatValue" fixing this issue: - Fix Issue 18051 - missing enum support in formattedRead/unformatValue https://github.com/dlang/phobos/pull/8345
Comment #4 by dlang-bot — 2021-12-31T10:28:12Z
dlang/phobos pull request #8345 "Fix Issue 18051 - missing enum support in formattedRead/unformatValue" was merged into master: - b8d99cca2df744b13d78b8918524cbe00ad343dd by wolframw: Fix Issue 18051 - missing enum support in formattedRead/unformatValue https://github.com/dlang/phobos/pull/8345