www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - enum : type

I get errors that only seem to happen when specifying a base type for the
enum:


enum Foo: ubyte
{
   ONE = 1,
   TWO = 2,
   ALL = ONE | TWO, // here
}
enum Bar: ubyte
{
   ONE = 1,
   TWO = 2,
}

void foo(Foo f);
void bar(Bar b);

int main()
{
   foo(Foo.ONE);
   bar(Bar.ONE | Bar.TWO); // here
   return 0;
}


function foo (Foo f) does not match argument types (ubyte)
cannot implicitly convert ubyte to Foo

function bar (Bar b) does not match argument types (int)
cannot implicitly convert int to Bar
Jun 25 2004