https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100570
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> --- I can't reproduce this. > g++ -c -x c++ test.cpp -I /usr/local/include/qt5 -I > /usr/local/include/qt5/QtCore -g2 -gdwarf-2 -Wall -Wswitch > -W"no-deprecated-declarations" -W"empty-body" -Wconversion -W"return-type" > -Wparentheses -W"no-format" -Wuninitialized -W"unreachable-code" > -W"unused-function" -W"unused-value" -W"unused-variable" -O0 > -fno-strict-aliasing -fno-omit-frame-pointer -fpic -fthreadsafe-statics > -fexceptions -frtti -std=c++20 -isystem /usr/local/include/qt5 Don't you need to also mark .../qt5/QtCore as a system include directory via -isystem /usr/local/include/qt5/QtCore? I suspect that will suppress the warning you're seeing.