I have a simple program in main.cpp
file:
import <iostream>;
import <format>;
int main() {
std::cout << std::format("{}, {}!", "Hello", "world") << std::endl;
}
It uses iostream
and format
modules which are compiled with
g++ -std=c++20 -fmodules-ts -xc++-system-header iostream
g++ -std=c++20 -fmodules-ts -xc++-system-header format
I compile the program with
g++ -std=c++20 -fmodules-ts main.cpp
then launch it - and it just hangs for a few seconds then the process stops without printing anything.
I compile and run it on Windows with MinGW g++ 13.1.0. After each crash a new report appears in the Reliability Monitor with exception code "c0000005". If I don't use this std::format
function then no crash happens (the program still has import <format>;
line).
Is it a bug in the standard library or do I compile something wrong? Can it be fixed somehow?