enum X { A, B = A } // will compile
enum Y { B = A, A } // won't, claims "circular reference"
That's a bit strange, isn't it?
If you don't specify a value for an enum it uses 1 more than the previous
value (or 0 for the first value), so in your first example A is given the
value 0 (because it's the first value) and then B is given the same value
(because you've specified it's equal to A).
In the second case you're saying B should be equal to A, so it needs to work
out the value of A. But since A has no assigned value and follows B, the
value of A should be B+1. Hence B is defined in terms of A and A is defined
in terms of B - a circular reference.
Chris Jobson