https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116936
--- Comment #2 from Filip Kastl <pheeck at gcc dot gnu.org> --- To replicate this bug, you can do for example gcc -x c++-header ./gcc/testsuite/g++.dg/header.C or gcc -x c-header ./gcc/testsuite/gcc.dg/header.c There are many more GCC testsuite testcases that produce this error. Looks like the error happens only when one of the input files is a header.