Bug in g++ 10.1.0 with libstdc++ compile following program doing `g++-10 -std=c++20 -Wzero-as-null-pointer-constant` #include <iostream> #include <compare> int main () { bool result { (1 <=> 2) < 0 }; std::cout << (result ? "Yes" : "No") << std::endl; } produces the error: foo.cc:5:27: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant] Also compiler-synthesized comparisons will generate this which is especially confusing as they can happen when calling a library function that needs the '<' operator. the exact version of GCC: 10.1.0 the system type: MacOS 10.15 (and Ubuntu 18.4 LTS using apt-get of gcc 10) the options given when GCC was configured/built: (homebrew version): Configured with: ../configure --build=x86_64-apple-darwin19 --prefix=/usr/local/Cellar/gcc/10.1.0 --libdir=/usr/local/Cellar/gcc/10.1.0/lib/gcc/10 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-10 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 10.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk SED=/usr/bin/sed
I think this is a dup of bug 95242.
(In reply to Andrew Pinski from comment #1) > I think this is a dup of bug 95242. Could be: I'm not sure if Jason's change applies only to synthesized comparators or not (that was the case described in 95242 and was the second case I mentioned). I hope it is already fixed. However the test case I submitted is the user-supplied 0 literal per the standard the standard, not a synthetic case. So might or might not be; I no longer grok the gcc internals so can't tell myself. Thanks -d
Confirmed with today's top of trunk and GCC 10.2.