D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4518 - to!string(enum w/invalid value) produces a somewhat unhelpful error
Summary: to!string(enum w/invalid value) produces a somewhat unhelpful error
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other All
: P2 enhancement
Assignee: Shin Fujishiro
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2010-07-27 01:24 UTC by Brad Roberts
Modified: 2010-09-14 01:13 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Brad Roberts 2010-07-27 01:24:41 UTC
I don't have a quick repro demo yet, but the result is this:

std.conv.ConvError: There is no corresponding enum member name in const(myEnum)

It would be very nice to add the actual value encountered.

Quick incomplete/untested mockup:

enum A { a = 1 }

writef("%s", cast(A)2);
Comment 1 Brad Roberts 2010-09-14 01:13:51 UTC
Fixed by rsinfu in:
http://www.dsource.org/projects/phobos/changeset/1961