[Bug c++/49896] undefined reference to static const integral member whose address is not used, for some values of the constant

harald at gigawatt dot nl gcc-bugzilla@gcc.gnu.org
Sat Jul 30 14:59:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49896

--- Comment #6 from Harald van Dijk <harald at gigawatt dot nl> 2011-07-30 14:59:09 UTC ---
> The initializer results in integer overflow which is undefined behaviour

No, it doesn't result in integer overflow. 0x80000000 is a constant of type
unsigned int, which is implicitly converted to the desired type of int.
Converting an out-of-range integer value to a signed integer type is
implementation-defined which has been defined in GCC in a sensible way,
documented at
<http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Integers-implementation.html>.



More information about the Gcc-bugs mailing list