[Bug c++/85269] warn for referenced standard symbols that aren't guaranteed to be declared in a header
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Apr 7 19:35:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85269
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> 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.
Also, <iostream> is now guaranteed to include <ostream>, but wasn't in previous
versions of the standard.
According to the standard, std::char_traits is defined by <string>, but in
practice it has to be defined by <ios> and <string_view> as well, so it would
be unhelpful to warn about using it without <string>.
Similarly, std::allocator is defined in <memory>, but has to be defined by most
containers (and other headers) so it would be unhelpful to warn about using
std::allocator without <memory>.
Making this warning actually useful might be a lot of work.
More information about the Gcc-bugs
mailing list