On Monday, 5 June 2017 at 01:42:55 UTC, Jonathan M Davis wrote:
On Monday, June 05, 2017 01:30:47 Mike B Johnson via Digitalmars-d-learn wrote:
[...]

It's not a bug. The alias this conversion only goes one way. It provides a way to convert _from_ the type that it's declared on to another type, not from the other type to the type that it's declared on. There is no way in D to declare an implicit conversion in the direction you're trying. So, if you have a struct that wraps an int like this, and you want to assign it an int, you're going to need to explicitly construct the struct - e.g. EnumX(1).

- Jonathan M Davis

That's pretty crappy! Defeats the whole point!

Reply via email to