This diagnostic warning was added on users' request.
The analyzer allows you to detect all the implicit conversions of enum-types to integer types.
The V2006 diagnostic rule helps perform code refactoring and sometimes find errors.
Here are examples of constructs the analyzer generates this diagnostic message for:
enum Orientation {
Horizontal = 0x1,
Vertical = 0x2
};
...
Orientation orientation = Horizontal;
int pos = orientation; // V2006
if (pos == Vertical) // Ok
{
...
}
The V2006 diagnostic message is not generated if two values of the enum type are compared or if bitwise operations are executed on them.
If you feel like the New Year just came, and you missed the first half of January, then all this ...