https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85269
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Could you clarify the suggestion? Should your first example warn because std::locale is only declared not defined? What if we later modify <string> so it does include the whole of <locale>, would that stop the warning? The user code is just as non-portable so the warning would be just as useful. But to warn even if the right header has been included would mean tracking whether it was included directly or transitively, and if transitively then deciding whether that was included by "the user" or not. Should this warn? #include <string> #include "foolib.h" // includes <locale> void f (std::locale); Would it depend on whether foolib.h was a system header? Also, we'd need to be careful so that we don't warn about referring to std::ostream without <ostream>, because <iosfwd> exists specifically to make that possible.