Как целочисленные типы преобразуются неявно?

Следующий код не проходит проверку MISRA. Конкретное сообщение об ошибке:

(MISRA-C:2004 10.1/R) The value of an expression of integer type shall not be implicitly converted to a different underlying type if it is not a conversion to a wider integer type of the same signedness

<code>typedef enum _MyEnum { One, Two } MyEnum;
MyEnum MyVariable;

int foo(void)
{
    int result = 1;

    if (One == MyVariable)  // fails here with MISRA-C:2004 10.1/R
    {
        result = 2;
    }    
    return result;
}
</code>
Why is the logical expression converted? What is converted here? Why does the code pass the MISRA check, when I swap One and MyVariable?

EditКомпилятор - это TI "MSP430 C / C ++ Compiler v4.0.0". с включенной проверкой правил MISRA.

Ответы на вопрос(3)

Ваш ответ на вопрос