gcc.libstdcxx
libstdc++ from the GCC payload as the C++ standard library of an llvm build (provides mcpp:c++-abi=libstdc++)
mcpp add gcc.libstdcxx@16.1.0.1
用法
來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。
// The C++ library under clang is libstdc++ (gcc.libstdcxx): `import std` comes
// from its `bits/std.cc`, a typed catch matches what its runtime threw, and the
// program carries no libc++. `<version>` is included for the one macro a
// module does not export: the library's own name.
#include <version>
import std;
int main() {
#if defined(__linux__)
# if !defined(__GLIBCXX__) || !defined(__clang__)
std::println("expected clang over libstdc++");
return 1;
# endif
#endif
std::vector<int> v{3, 1, 2};
std::ranges::sort(v);
try {
throw std::runtime_error(std::format("{}", v));
} catch (const std::exception& e) {
if (std::string_view(e.what()) != "[1, 2, 3]") return 2;
} catch (...) {
return 3;
// …
tests/examples/libstdcxx-llvm/tests/libstdcxx.cpp · 專案 tests/examples/libstdcxx-llvm
建置
A 型套件:上游壓縮檔自帶 mcpp.toml(在 mcpp.toml)。本次建置沒有抓取它的內容 —— 執行一次索引的重新整理動作就能拉進來。