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

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #2 from Harald van Dijk <harald at gigawatt dot nl> ---
(In reply to Andreas Schwab from comment #1)
> The C++ standard says: [lex.icon] "If an integer literal cannot be
> represented by any type in its list and an extended integer type (6.8.1) can
> represent its value, it may have that extended integer type."

__int128 behaves mostly like an integer type but is not an "extended integer
type" as defined in the standard. Quoting from
https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html: "GCC does not
support any extended integer types." Extended integer types must meet specific
requirements that __int128 does not meet: extended integer types cannot be
larger than intmax_t, and __int128 is.

Despite __int128 not being an extended integer type, there is nothing wrong
with having __int128 enabled in standards-conforming mode. Out-of-range
constants must be diagnosed, but they already are, and continuing to accept the
program after that is valid.

The warning that is generated for the out-of-range constant is highly
misleading though: the warning says "integer constant is so large that it is
unsigned". Either the constant should be given an unsigned type, or the warning
should be updated to reflect the type the constant actually gets.

Reply via email to