<format> 模块中的 c++ std::format 使程序崩溃

c++ std::format from <format> module crashes the program

提问人:Sun of A beach 提问时间:7/1/2023 最后编辑:IntegralPilotSun of A beach 更新时间:7/1/2023 访问量:62

问:

我有一个简单的程序:main.cpp

import <iostream>;
import <format>;

int main() {
  std::cout << std::format("{}, {}!", "Hello", "world") << std::endl;
}

它使用和模块,这些模块编译为iostreamformat

g++ -std=c++20 -fmodules-ts -xc++-system-header iostream
g++ -std=c++20 -fmodules-ts -xc++-system-header format

我用

g++ -std=c++20 -fmodules-ts main.cpp

然后启动它 - 它只是挂起几秒钟,然后该过程停止而不打印任何东西。

我使用 MinGW g++ 13.1.0 在 Windows 上编译并运行它。每次崩溃后,可靠性监视器中都会显示一个新报告,异常代码为“c0000005”。如果我不使用此功能,则不会发生崩溃(程序仍然有行)。std::formatimport <format>;

是标准库中的错误还是我编译了错误?可以以某种方式修复吗?

模块 崩溃 std c++20 stdformat

评论


答: 暂无答案