https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99019
Bug ID: 99019 Summary: A nicer error hint, for cpp modules, if missing headers Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: StevenSun2021 at hotmail dot com Target Milestone: --- This is not a bug but can be improved. If I forget to include headers, like the following ------------------------------- export module B; export void foo() { std::cout << 1; } ------------------------------- Compile it with g++ 11, I get an error hint: ------------------------------- test.cpp: In function ‘void foo()’: test.cpp:5:10: error: ‘cout’ is not a member of ‘std’ 5 | std::cout << 1; | ^~~~ test.cpp:1:1: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? +++ |+#include <iostream> 1 | export module B; ------------------------------- Actually it should be +++ |+module; +++ |+#include <iostream> 1 | export module B; Using a build of brunch devel/c++-modules. Built 3 days ago.