В соответствии с запросом Bathsheba и в качестве последующего вопроса "Что произойдет, если перечисление не может вписаться в интегральный тип?" :
Агрегат перечисления определяется следующим образом:
enum foo : unsigned int
{
bar = UINT_MAX,
oops
};
Определено ли значение oops
или нет?
MSVS2015 компиляция:
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'
Выход MSVS2015:
bar = 4294967295
oops= 0
gcc 4.9.2 компиляция:
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
gcc 4.9.2 output
//compilation failed