V2006. Implicit type conversion from enum type to integer type.


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.


Bugs Found

Checked Projects
334
Collected Errors
12 668