[Bug c++/61584] What defines std::underlying_type?

potswa at mac dot com gcc-bugzilla@gcc.gnu.org
Mon Jun 23 07:28:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61584

--- Comment #2 from David Krauss <potswa at mac dot com> ---
C "compatible type" determines integer conversion rank (C11 §6.3.1.1). C++
fixes the rank by a heuristic which the implementation cannot decide (C++11
§4.5/3).

Currently, enum promotions are incompatible between C and C++ modes.
Furthermore, when C++ requires promotion to signed int but the underlying type
is unsigned int, integer overflow may occur.

I think this adds up to a bug and the C++ behavior should get its own bullet at
the end of that manual page.


More information about the Gcc-bugs mailing list