Implicit casting of int enum members to int

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 4 18:20:49 PDT 2017


On Mon, Jun 05, 2017 at 01:23:22AM +0000, Mike B Johnson via Digitalmars-d-learn wrote:
> On Monday, 3 October 2016 at 09:21:37 UTC, Jonathan M Davis wrote:
> > [...]
> 
> Is this bug ever going to be fixed?
> 
> I can't do
> 
> enum X : Y
> {
>    a = 1
> }
> 
> because 1 is not implicitly convertible to Y, even though Y is aliased
> to an int so it should be.

Works for me:

	alias Y = int;
	enum X : Y {
		a = 1
	}

Please post a minimal example that doesn't work.


T

-- 
Try to keep an open mind, but not so open your brain falls out. -- theboz


More information about the Digitalmars-d-learn mailing list