[Issue 18051] New: missing enum support in formattedRead/unformatValue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 9 16:09:16 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=18051

          Issue ID: 18051
           Summary: missing enum support in formattedRead/unformatValue
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: code at dawg.eu

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.

--


More information about the Digitalmars-d-bugs mailing list