https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120160
Bug ID: 120160 Summary: Implicitly import std if stadard library header is included Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Please add a preprocessor macro that replaces content of the header with `import std;` if the macro is defined by user. For example libstdc++-v3/include/std/vector can be changed in the following way: #ifndef _GLIBCXX_VECTOR #define _GLIBCXX_VECTOR 1 #if defined(GLIBCXX_IMPLICIT_MODULES_USE) import std; #else #ifdef _GLIBCXX_SYSHDR #pragma GCC system_header #endif ... // all the remaining code from <vector> #endif /* GLIBCXX_IMPLICIT_MODULES_USE */ #endif /* _GLIBCXX_VECTOR */ Motivation: 1. Implicit `import std;` in standard library header would improve compile times if module std is available. 2. Migration from includes to `import std;` for big projects is not trivial. The above approach eases that migration