What happens if an enum cannot fit into an unsigned integral type?
<p>As requested by <a href="https://stackoverflow.com/users/2380830/bathsheba">Bathsheba</a> and as a follow up question to <a href="https://stackoverflow.com/questions/39620802/what-happens-if-an-enum-cannot-fit-into-an-integral-type">"What happens if an enum cannot fit into an integral type?"</a>:</p>

<p>Asuming an enum is defined as follows :</p>

<pre><code>enum foo : unsigned int
{
    bar = UINT_MAX,
    oops
};
</code></pre>

<p>Is the value of <code>oops</code> defined or isn't it?</p>

<hr>

<p>MSVS2015 compilation:</p>

<pre><code>warning C4340: 'oops': value wrapped from positive to negative value
warning C4309: 'initializing': truncation of constant value
warning C4369: 'oops':  enumerator value '4294967296' cannot be represented as 'unsigned int', value is '0'
</code></pre>

<p>MSVS2015 output:</p>

<pre><code>bar = 4294967295
oops= 0
</code></pre>

<hr>

<p>gcc 4.9.2 compilation:</p>

<pre><code>9 : note: in expansion of macro 'UINT_MAX'
bar = UINT_MAX,
^
10 : error: enumerator value 4294967296l is outside the range of underlying type 'unsigned int'
oops
^
Compilation failed
</code></pre>

<p>gcc 4.9.2 output</p>

<pre><code>//compilation failed
</code></pre>