<div><font face="courier new, monospace">Greetings</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">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.</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">BTW if I declare all a,b,c and d as "enum BING_e", then DMD gives errors for both line 6 and 9.</font></div><div>
<font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Regards</font></div><div><font face="courier new, monospace">- Puneet</font></div><font face="courier new, monospace"><div><font face="courier new, monospace"><br>
</font></div><div><font face="courier new, monospace"><br></font></div>enum BING_e: byte {NONE_BING = 0b00, FOO_BING = 0b01, // 1<br> BAR_BING = 0b10, BOTH_BING = 0b11} // 2<br>void main() { // 3<br>
BING_e a = BING_e.FOO_BING; // 4<br> BING_e b = BING_e.BAR_BING; // 5<br> BING_e c = a | b; // 6<br> import std.stdio; // 7<br>
writeln(c); // 8<br> BING_e d = a & b; // 9<br> import std.stdio; // 10<br> writeln(d); // 11<br>
} // 12</font><br>