https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107750
--- Comment #7 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> --- I think I've found what's going on: <sys/socket.h> really has #if !defined(_XPG4_2) || defined(__EXTENSIONS__) #ifndef NC_TPI_CLTS #define NC_TPI_CLTS 1 /* must agree with netconfig.h */ #define NC_TPI_COTS 2 /* must agree with netconfig.h */ [...] #if !defined(_XPG4_2) || defined(__EXTENSIONS__) #define SOCK_STREAM NC_TPI_COTS /* stream socket */ #define SOCK_DGRAM NC_TPI_CLTS /* datagram socket */ [...] #else #define SOCK_STREAM 2 /* stream socket */ #define SOCK_DGRAM 1 /* datagram socket */ The problem seems to be the indirection: when SOCK_DGRAM etc. are defined as numeric constants, things work, while the indirection via NC_TPI_* does not.