[Issue 8432] write needs to print full enum type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 25 11:54:06 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8432



--- Comment #3 from bearophile_hugs at eml.cc 2012-07-25 11:54:03 PDT ---
(In reply to comment #2)

> enum Type { Class, Struct, Enum }
> 
> struct Class { }
> struct Struct { }
> struct Enum { }
> 
> void main()
> {
>     Type[string] type = ["foo" : Type.Class];
>     writeln(type);
> }
> 
> outputs:
> ["foo":Class]
> 
> This output confused me since Class is both a struct definition and a named
> enumerated value.

A partial solution is to add the type:

writeln(typeof(type).stringof, ": ", type);

It prints:

Type[string]: ["foo":Class]

Now you see that the keys can't be the struct name.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list