I've opened this GCC bug for the case where FMT_SYSTEM_HEADERS workaround doesn't work. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116515 It appears when using LTO the warnings happen at link system and GCC doesn't respect isystem at link time.