With latest rawhide glibc/gcc, the fish started to be FTBFS. See https://github.com/fish-shell/fish-shell/issues/6609 for more details. ../src/wutil.cpp: In function 'int fd_check_is_remote(int)': ../src/wutil.cpp:311:14: error: narrowing conversion of '4283649346' from 'unsigned int' to 'int' [-Wnarrowing] 311 | case 0xFF534D42: // CIFS_MAGIC_NUMBER | ^~~~~~~~~~ With adding `u` for the `case`s, that does not make problem go away: ../src/wutil.cpp: In function 'int fd_check_is_remote(int)': ../src/wutil.cpp:311:14: error: narrowing conversion of '4283649346' from 'unsigned int' to 'int' [-Wnarrowing] 311 | case 0xFF534D42u: // CIFS_MAGIC_NUMBER | ^~~~~~~~~~~ Only explicit cast in switch() to unsigned int helps to silence this warning.
Not a compiler bug. The C++ standard requires this to be diagnosed. That value cannot be converted to an int without changing its value. If you want the int value corresponding to that bit pattern, you need to use (int)0xFF534D42. If the switch is meant to be using unsigned, cast the switch expression to unsigned int (as suggested in the github issue). Adding a u suffix makes no difference because the type is already unsigned int, because the value 0xFF534D42 is too large for int. The problem is that the switch expression is an int, so any case which can't be represented as an int is ill-formed.
(In reply to Jonathan Wakely from comment #1) > Not a compiler bug. The C++ standard requires this to be diagnosed. > > That value cannot be converted to an int without changing its value. If you > want the int value corresponding to that bit pattern, you need to use > (int)0xFF534D42. If the switch is meant to be using unsigned, cast the > switch expression to unsigned int (as suggested in the github issue). > > Adding a u suffix makes no difference because the type is already unsigned > int, because the value 0xFF534D42 is too large for int. The problem is that > the switch expression is an int, so any case which can't be represented as > an int is ill-formed. Hi Jonathan, thanks for the reply! So since the fix (casting the switch expression) is correct (I assume), I'll close this bug.