mcpp index

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)。本次构建没有抓取它的内容 —— 跑一次索引的刷新动作就能拉进来。

版本

版本平台 镜像sha256
16.1.0.1 最新 Linux GLOBAL CN 9d6b43ce4d8d…