I have the following two files:
//building.cpp
export module building;
export import building:apartment;
//apartment.cpp
module;
#include<iomanip>
export module building:apartment;
void test(){
std::streambuf* buf;
std::ostream os(buf);
os<<std::setw(17);
}
Using GCC11, I do
$ g++ -c apartment.cpp -std=c++20 -fmodules-ts
$ g++ -c building.cpp -std=c++20 -fmodules-ts
this code does not compile (internal compiler error). However, if I include iomanip into apartment.cpp and building.cpp I receive no errors. I remember a similar situation with the MSVC compiler. What am I doing wrong? Should the same include statements be included in the module file and its partition?