Why compiler doesn't complain the wrong enum value
<pre><code>#include &lt;iostream&gt;

enum IsOptionAEnum
{
    IsOptionA_YES,
    IsOptionA_NO
};

enum IsOptionBEnum
{
    IsOptionB_YES,
    IsOptionB_NO
};

void TestFunc(IsOptionAEnum optionA, IsOptionBEnum optionB)
{
    if (optionA == IsOptionA_YES || optionA == IsOptionB_YES) // typo
    {
        // ...
    }

    //if (optionA == IsOptionA_YES || optionB == IsOptionB_YES) // correct one
    //{
    //}

}
</code></pre>

<p>Question> <code>optionA</code> is of type <code>IsOptionAEnum</code> and doesn't have the value of <code>IsOptionB_YES</code>. Why does the compiler of VS2010 not find this error?</p>

<p>If it is the case where compiler cannot find the error, is there a way that I can enforce this restriction so that compiler can find the error?</p>
