https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112307
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> --- You need -x c++ for the first command, otherwise the preprocessor runs as C and will not have any C++ macros (like --cplusplus) defined. g++ -E does *not* imply C++