On 2013-03-01 13:56, d coder wrote:
Currently DMD allows me to bit-or two enum variables, but not bit-and. For
example in the following code, DMD is OK with line 6, but gives an error
for line 9. I do not see any logic why DMD does that. Is it a bug or is it
intended.

Strange. | and ^ work but & fails. The promotion from byte to int is unnecessary in any of those 3 ops. It works correctly for non-enums:

    byte x, y, z = 1;
    z = x | y; z = x ^ y; z = x & y; z = x >> y;  // all OK
    z = x << y; z = x + y; z = x * y; z = x / y;  // can't convert int to byte

Not sure why byte enum would be handled any differently than simple byte.

Reply via email to