D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6916 - writeln of nameless enum
Summary: writeln of nameless enum
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-08 19:23 UTC by bearophile_hugs
Modified: 2011-11-17 15:48 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-11-08 19:23:58 UTC
D2 code:

import std.stdio;
enum E : int { A, B }
void main() {
    writeln(E.B);
}


Nice runtime output, DMD 2.057head:
B


A second D2 program:


import std.stdio;
enum : int { A, B }
void main() {
    writeln(B);
}


Runtime output, DMD 2.057head:
1


Is it possible for writeln() to write the handy enum name "B" in this case too?
Comment 1 bearophile_hugs 2011-11-15 23:54:16 UTC
Maybe related to issue 5004
Comment 2 bearophile_hugs 2011-11-17 15:48:09 UTC
It can't work like this.