http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47108
Summary: enum won't use long long as underlying type Product: gcc Version: unknown Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: flo.ru...@hotmail.com c++0x introduce long long, which should be used as the base type for enum if on of the enumerators doesn't fit in int, 7.2.6: For an enumeration whose underlying type is not fixed, the underlying type is an integral type that can 6 represent all the enumerator values defined in the enumeration. If no integral type can represent all the enumerator values, the enumeration is ill-formed. It is implementation-defined which integral type is used as the underlying type except that the underlying type shall not be larger than int unless the value of an enumerator cannot fit in an int or unsigned int. If the enumerator-list is empty, the underlying type is as if the enumeration had a single enumerator with value 0. the folowing program demonstrates the bug, note that gcc does give a warning: #include <iostream> int main(){ enum{ waf=1<<33 }blaf; std::cout<<sizeof(blaf)<<'\n'; } it will print 4 meaning it chose int as the underlying type which is wrong because 1<<33 doesn't fit in int but it does in long long so it should've chosen that instead. note that this doesn't apply for strict c++98 as it requires no long long type. it should probably be fixed anyway