https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85021
Bug ID: 85021 Summary: "Missing #include" hints for unrecognized names that would implicitly be in "std" Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Target Milestone: --- We provide fix-it hints for the most common "std::" names: void f() { std::cout << "test"; } <source>: In function 'void f()': <source>:2:10: error: 'cout' is not a member of 'std' std::cout << "test"; ^~~~ <source>:2:10: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'? +#include <iostream> void f() { std::cout << "test"; ^~~~ However we don't yet provide a fix-it hint for: using namespace std; void f() { cout << "test"; } <source>: In function 'void f()': <source>:3:5: error: 'cout' was not declared in this scope cout << "test"; ^~~~ We probably should handle such names if there's a "using namespace std;" active, and print something like: <source>: In function 'void f()': <source>:3:5: error: 'cout' was not declared in this scope cout << "test"; ^~~~ <source>:3:5: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'? +#include <iostream> void f() { cout << "test"; ^~~~