Why doesn't to!MyEnumType(42) work

Tommi tommitissari at hotmail.com
Mon Jul 16 10:35:32 PDT 2012

According to the docs, std.conv.to uses cast operator under the 
hood, and since the following works:

enum MyEnumType {a}
auto val = cast(MyEnumType) 42;

...it seems natural that to!MyEnumType(42) should work as well. 
But currently it gives error:
template instance std.conv.to!(MyEnumType).to!(int) error 

More information about the Digitalmars-d mailing list