On Tuesday, 29 October 2013 at 18:23:03 UTC, bearophile wrote:
Ali Çehreli:
>> enum Foo { A, B, C }
>> void main() {
>> bool[5] bools;
>> auto b = bools[2] != Foo.C;
>> bools[2] = Foo.A;
>> }
...
There was a long discussion about that. Walter was happy that
bool was a integer type. Many of us had objections:
My problem is mostly with enums. I don't remember Walter
explaining the rationale of the D enum conversion design. I
prefer the C++11 enums.
Bye,
bearophile
Bools being integer types is reason of your problem with enums.
Relevant lines from your code are translated to:
bool b = 0 != 2;
bools[2] = 0;
taking into account that 'bool' is integer type having capacity
to represent values 0 and 1.