https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103848
--- Comment #8 from Stefan BrĂ¼ns <stefan.bru...@rwth-aachen.de> --- (In reply to Jonathan Wakely from comment #2) > This is not a bug. > > Firstly, there's no testcase provided (as https://gcc.gnu.org/bugs says is > needed). Here's the missing testcase: > > #include <deque> > std::deque<int> d; > auto n = d.begin() - d.begin(); > > Secondly, the command to reproduce the error is not provided, as the link > also says is needed. This "error" only happens with > -Werror=zero-as-null-pointer-constant -Wsystem-headers, so don't do that. > This is not even a warning unless you explicitly ask for it (it's not in > -Wall or -Wextra) and if you choose to make it an error, that's your fault. > > We can't nullptr because the code needs to compile as C++98. We could use > NULL or __null, or Jakub suggested just _Map_pointer. I find all of those > inferior to 0 but I suppose we can change it. Full GCC command line: ``` [ 826s] g++ -c -o test_allheaders_allheaders.o -I/home/abuild/rpmbuild/BUILD/wxWidgets-3.1.5/lib/wx/include/gtk3-unicode-3.1 -I../include -D_FILE_OFFSET_BITS=64 -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/uuid -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/wayland -I/usr/include/libxkbcommon -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -D__WXGTK__ -I. -DWXUSINGDLL -I./../samples -I../3rdparty/catch/include -pthread -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wno-deprecated-declarations -I/usr/include/freetype2 -I/usr/include/uuid -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gtk-3.0/unix-print -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/wayland -I/usr/include/libxkbcommon -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/at-spi-2.0 -I/usr/include/SDL2 -D_REENTRANT -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -I/usr/include/webkitgtk-4.0 -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -DPIC -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g ./allheaders.cpp [ 826s] In file included from /usr/include/c++/11/deque:67, [ 826s] from /usr/include/c++/11/queue:60, [ 826s] from ../include/wx/msgqueue.h:24, [ 826s] from ./allheaders.h:239, [ 826s] from ./allheaders.cpp:435: ``` So definitely neither -Werror=zero-as-null-pointer-constant nor -Wsystem-headers. GCC -v ``` Using built-in specs. Reading specs from /usr/lib64/gcc/x86_64-suse-linux/11/defaults.spec COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/11/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-suse-linux Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go,d,jit --enable-offload-targets=nvptx-none,amdgcn-amdhsa, --without-cuda-driver --enable-host-shared --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/11 --enable-ssp --disable-libssp --disable-libvtv --enable-cet=auto --disable-libcc1 --enable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-libphobos --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-11 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --with-build-config=bootstrap-lto-lean --enable-link-mutex --build=x86_64-suse-linux --host=x86_64-suse-linux Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b] (SUSE Linux) ```