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

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
I didn't test carefully enough.  The C front end does the right thing (below)
but as you noted the C++ front end does still suffer from the problem.  Thanks
for double checking me!

$ /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -S -Wall -Wextra
gcc-31158.c
gcc-31158.c: In function ‘main’:
gcc-31158.c:5:21: warning: overflow in implicit constant conversion
[-Woverflow]
 /*   5 */         { 65536U }
                     ^~~~~~


$ /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -S -Wall -Wextra
-std=c++98 -xc++ gcc-31158.c
gcc-31158.c: In function ‘int main()’:
gcc-31158.c:6:15: warning: narrowing conversion of ‘65535u’ from ‘unsigned int’
to ‘short int’ inside { } is ill-formed in C++11 [-Wnarrowing]
 /*   6 */     };
               ^
gcc-31158.c:6:15: warning: narrowing conversion of ‘65536u’ from ‘unsigned int’
to ‘short int’ inside { } is ill-formed in C++11 [-Wnarrowing]
gcc-31158.c:6:15: warning: overflow in implicit constant conversion
[-Woverflow]

Reply via email to