This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Unsure about a new warning in mainline
Paolo Carlini <pcarlini@suse.de> writes:
[...]
| >Specifically, for PR 30465 "((T)1 << 31) - 1" is potentially undefined
| >when T is a 32-bit signed type, but well-defined if T is unsigned or
| >wider than 32-bits.
| >
| FYI: this specific issue arises from std::numeric_limits<wchar_t> on
| x86-linux: in particular from the __glibcxx_max macro at the beginning
| of the header. Luckily, since we are dealing with template
| specializations, the pragma is sufficient to suppress the warning, but
| if you can figure out a better way to compute the max itself, just
| speak...
I would like to understand this issue better and AVOID the pragma.
If we need a pragma to make numeric_limits<wchar_t> not trigger
warning then something is broken in either the warning machinery or
numeric_limits<wchar_t> or both.
-- Gaby