https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105512
Bug ID: 105512 Summary: compilation with -fmodules-ts and std=c++20 leads to segfault Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: deco33000 at yandex dot com Target Milestone: --- Hi, compiling with -fmodules-ts and -std=c++20 leads to a segfault. With c++17 no errors. Without std= switch, no segfault. But c++20 is required in my code, hence the report. Here is the reduced code: ----- main.cpp import hello; int main ( void ){ X::greeter("ok"); return 0; } -----mod.cxx module; #include <iostream> #include <string_view> #include <string> export module hello; import sub_mod; namespace X { void greeter2 ( std::string_view const &name ){ std::string h = "exported greeter"; std::cout << "Bye " << name << "!" << h << "\n"; Y::g(); } } export { namespace X { void greeter ( std::string_view const &name ){ std::string h = "exported greeter"; std::cout << "Hello " << name << "!" << h << "\n"; greeter2("ff"); } } } -----mod_sub.cxx module; #include <iostream> export module sub_mod; export { namespace Y { auto g (){ std::cout << "in out " << std::endl; } } } The following works with c++17 and c++20 flags (no issue): ----- mod_sub.cxx corrected (no global fragment): export module sub_mod; export { namespace Y { auto g ()-> int{ //std::cout << "in out " << std::endl; return 54; } } } and ----- mod.cxx corrected (prints g() directly): module; #include <iostream> #include <string_view> #include <string> export module hello; import sub_mod; namespace X { void greeter2 ( std::string_view const &name ){ std::string h = "exported greeter"; std::cout << "Bye " << name << "!" << h << " " << Y::g() <<"\n"; } } export { namespace X { void greeter ( std::string_view const &name ){ std::string h = "exported greeter"; std::cout << "Hello " << name << "!" << h << "\n"; greeter2("ff"); } } } Thanks,