libycxx
Contents

Spec sheet · libycxx 0.1.0

An independent C++26 standard library

An independent C++26 standard library for GCC and Clang, implemented from the working draft, with its own Itanium C++ ABI runtime. Freestanding, hosted, and available through import std;.

Standard
C++26 (the current working draft), C++26 only
Compilers
the latest GCC and Clang (matrix)
Platforms
Linux and macOS; bare-metal targets freestanding (matrix)
Layers
freestanding core · hosted library · platform abstraction layer
ABI runtime
its own: exceptions, RTTI, dynamic_cast, guards
Modules
import std; and import std.compat;
hello.cpp
import std;

int main() {
  std::vector<std::string> words{"modules", "import", "std"};
  std::ranges::sort(words);
  // prints ["import", "modules", "std"]
  std::println("{}", words);
}
CMake configuration for this example
CMakeLists.txt
cmake_minimum_required(VERSION 3.28)

# libycxx is fetched before project(): its toolchain file chooses the compiler,
# Clang 23 by default, and downloads it into a cache when it is missing.
include(FetchContent)
FetchContent_Declare(libycxx
  GIT_REPOSITORY https://github.com/yrashk/libycxx
  GIT_TAG main          # no release yet; a release tag will go here
  GIT_SHALLOW TRUE
  SOURCE_SUBDIR cmake)  # no CMakeLists.txt there: fetched now, added below
FetchContent_MakeAvailable(libycxx)
set(YCXX_COMPILER clang CACHE STRING "clang or gcc")
set(YCXX_PROVISION ON CACHE BOOL "Install the compiler when it is missing")
set(CMAKE_TOOLCHAIN_FILE ${libycxx_SOURCE_DIR}/cmake/ycxx-toolchain.cmake)

project(hello CXX)
add_subdirectory(${libycxx_SOURCE_DIR} ${libycxx_BINARY_DIR} EXCLUDE_FROM_ALL)

add_executable(hello hello.cpp)
# import std; from libycxx's modules (brings ycxx::ycxx)
target_link_libraries(hello PRIVATE ycxx::modules)

Build this example with the commands in Getting started.

C++26every headerthe C++26 library, freestanding and hosted
2,824own testsspec-derived, all passing in CI on Linux and macOS
17,098external testslibc++ and libstdc++ suites, run unmodified
19real-world projectsbuilt and tested against libycxx, linkage proved
01

What it is

Select libycxx explicitly in place of the toolchain’s libstdc++ or libc++.

The freestanding core needs no operating system or C library. The hosted library adds streams, files, threads, clocks, and locales through a small C platform abstraction layer. Its own ABI runtime handles exceptions, RTTI, and guards; stack unwinding comes from the toolchain.

02

What is implemented

Every C++26 library header is provided, including the deprecated facilities the draft still specifies. Compiler-dependent features have known gaps.

For callbacks with explicit storage limits, <ycxx/functional.hpp> provides ycxx::inplace_function and a compile-time query of function-wrapper inline storage. These are libycxx extensions; their API pages document capacity, alignment and allocation guarantees.

  • Language support & utilities

    Type traits, vocabulary types, function wrappers, and constexpr exceptions on GCC.

  • Containers & ranges

    All containers, ranges, and algorithms, including <hive>, <inplace_vector>, and <mdspan>.

  • Text

    Formatting, printing, character conversion, regex, and text encodings.

  • Numerics

    Random engines and distributions, SIMD, linear algebra, and math facilities.

  • Time

    Calendars, utc/tai/gps clocks, leap seconds, and the system’s time zone database.

  • Concurrency

    Threads, atomics, synchronization, RCU, hazard pointers, and senders and receivers.

  • I/O & locales

    Streams, filesystem, standard locale facets, and named locales from the C library.

  • Diagnostics

    Stack traces, debugging, contracts, and reflection where the compiler supports them.

Freestanding builds, modules, and spec audits

Freestanding, hosted and modules

Every core header, every header with a freestanding subset and every header of the draft’s freestanding table compiles with -ffreestanding -nostdlib -nostdinc -fno-exceptions -fno-rtti; a smoke test links for x86_64-unknown-none-elf and riscv64-unknown-elf. An optional runtime archive, ycxx::freestanding, supplies allocation, floating-point <charconv> and the atomic wait tables to programs without an operating system.

The standard library modules std and std.compat are generated from the headers and built per project with the project’s own flags, from CMake (ycxx::modules) or with tools/ycxx-modules.

Audited against the draft

Three audits walk the synopses of the working draft and generate a check for every declaration, on both compilers (docs/SPEC_COVERAGE.md):

ClausesDeclarationsChecks
Library, support, concepts, diagnostics, memory, meta, utilities2,029every name, 313 macros
Containers, iterators, ranges, algorithms, strings6,16425,470
Text, numerics, time, I/O, threads, execution, Annex D6,36713,237

What remains open is compiler-blocked: Clang 23 has no reflection or contracts and cannot throw during constant evaluation; GCC 16 lacks is_within_lifetime.

03

How it is built

A handful of rules, written down in DECISIONS.md with their reasons and the alternatives that were rejected.

How it was written

Implemented by AI agents (Claude, directed by the author) from the draft, WG21 papers, POSIX, and the Itanium ABI, without access to other implementations’ sources during development.

This is not a legal clean-room claim: the models were trained on public code. See the full account and similarity analysis.

Hidden namespaces and reserved names

Public declarations live in the inline namespace std::__y1 of std, except the few the compilers name in std itself; internals use reserved names in hidden namespaces. Argument-dependent lookup stays out of implementation details, and hidden visibility isolates runtime symbols.

Strict preprocessor policy

config.hpp turns compiler and target facts into constexpr values or types. The library uses templates, constraints, and if constexpr rather than function-like macros.

Platform layer and hosted layers

The C primitives of ycxx/pal.h have POSIX providers by default. Supply individual layers yourself to use a custom heap, console, or other environment.

Its own ABI runtime

Exceptions, RTTI, dynamic_cast, static-local guards, and handlers come from libycxx’s Itanium ABI implementation. Only stack unwinding comes from the toolchain.

Named locales on the C library

Named locales use the C library’s per-locale functions on glibc and Darwin, without changing the global C locale or other threads.

Deliberate divergences from established libraries

Deliberate divergences

Where the draft and the established libraries disagree, libycxx follows the draft and says so; where the letter of the draft would break portable code, it follows practice and says that too. The full list is in STATUS.md (“Deliberate divergences”):

  • to_chars without a precision follows P3505 and the draft’s “smallest number of characters”, where older tests encode the C++17 rule.
  • Floating-point from_chars leaves the value unmodified on result_out_of_range, as the draft says.
  • <regex>’s ECMAScript grammar follows ECMA-262 (\a is an identity escape; a back-reference may precede its group).
  • regex_traits::transform_primary in the classic locale returns the whole sort key, so [[=a=]] keeps working there, as portable code expects.
  • expected’s operator== with a value deduces its left operand, to avoid a constraint recursion the literal signature causes.
04

How it is tested

Spec-derived tests, unmodified external suites, and real-world projects check the library beyond its own implementation.

2,824 own tests and the libc++ and libstdc++ suites run with GCC and Clang. Nineteen real-world projects build against libycxx and run their own tests. CI checks Linux and macOS; nightly jobs cover additional configurations.

Failures, skips, and expected failures carry their causes. Each run writes commands, results, and transcripts in HTML and Markdown. See the testing guide for how to run the suites.

Own suite: method and results

Its own suite, written from the draft

2,824 tests in tests/ycxx, written by an author who may read only the working draft and cppreference — never libc++’s or libstdc++’s tests, nor any implementation, libycxx’s included. A failing test is a library bug until the draft shows otherwise; tests are never weakened to fit. Tests that must not compile name the diagnostic they expect, and hardened preconditions have death tests. Running the suite against libstdc++ validates the tests themselves: every difference is listed and triaged.

Own suite on Linux (pass / fail / expected failure): default from CI, 2026-10-07; the others as recorded in STATUS.md, 2026-10-05/06
ConfigurationGCC 16.2Clang 23.1
Default2,723 / 0 / 152,698 / 0 / 40
Hardened (YCXX_HARDENED=1)2,425 / 0 / 132,418 / 0 / 20
No exceptions (-fno-exceptions)1,941 / 0 / 71,941 / 0 / 7
AddressSanitizer—2,685 / 0 / 39
ThreadSanitizer2,722 / 0 / 152,695 / 0 / 39
External suites and sanitizer configurations

libc++ and libstdc++ conformance suites

Both suites run unmodified from pinned releases (LLVM 23.1.2’s libcxx/test/std, GCC 16.2.0’s libstdc++ testsuite), fetched on demand and never vendored.

Full runs of 2026-10-05/06 (pass / fail / unsupported)
SuiteGCC 16.2Clang 23.1
libc++ (8,543 tests)7,494 / 211 / 8367,495 / 215 / 832
libstdc++ (8,555 tests)6,206 / 13 / 2,3356,161 / 13 / 2,344*

Every failure is categorised in tests/libcxx/TRIAGE.md and tests/libstdcxx/TRIAGE.md. Most are tests that rely on headers libstdc++ and libc++ include from one another, on their own specifics or pre-C++26 values, or on not running as root. Skipped tests carry a category and a reason and name the libycxx test that covers the subject. *Projected from the full run with the final lists.

Sanitizers, hardening and library modes

All three suites run under AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer, linked with a libycxx built with the same sanitizers — an uninstrumented library would hide every hand-off through its own mutexes and reference counts. The own suite also runs hardened, with -fno-exceptions and at -O2, each with its own report.

Real-world projects and their results

Nineteen real-world projects

tools/realworld builds open-source projects against libycxx with both compilers and runs their own test suites; then it proves the build was libycxx’s alone: every translation unit’s command, every object’s headers, every image’s needed libraries and symbols, and libycxx’s allocation table in every image. A self-test built with the toolchain’s library is rejected on every count.

Runs of 2026-10-07: every project built and passed with both compilers (CTest tests passed, GCC / Clang)
ProjectReleaseGCCClang
GoogleTestv1.18.06363
Abseil20260817.0242242
Google Benchmarkv1.9.58383
Catch2v3.16.08181
CLI11v2.7.28282
doctestv2.5.3191191
EnTTv4.0.01515
{fmt}12.2.02121
glazev9.0.0145140
Microsoft GSLv5.0.11515
nlohmann/jsonv3.12.0101101
libcorov0.16.01†1†
magic_enumv0.9.812 + 3 xfail15
oneTBBv2023.1.0141141
range-v30.12.0234236
simdjsonv5.0.2153153
spdlogv1.17.01†1†
Taskflowv4.1.02,9092,909
yaml-cpp0.8.01†1†

†One CTest test runs the project’s whole suite. All 19 also pass under AddressSanitizer, and five under ThreadSanitizer; neither reported anything in libycxx. The projects found three libycxx bugs (each fixed with a test) and four compiler bugs; their patches are to their own non-standard code, each with a category and reason.

CI and failure policy

Continuous integration, without baselines

Every push runs the policy checks, both library builds, the freestanding check, the CMake package test and the own suite on Linux (the gcc:16 container, Clang 23 from apt.llvm.org) and macOS (Apple Silicon, Homebrew’s GCC 16, Clang 23), and on Linux a sample of both external suites. Nightly, the whole external suites run on both compilers and both platforms, with the sanitizer, hardened, no-exceptions and -O2 configurations and the real-world projects. The platform and compiler matrix lists what each combination has passed.

There is no list of tolerated failures. A test reported FAIL fails the run, and every failure is resolved where its cause is decided: a libycxx bug is fixed; a test that does not apply is skipped with its category and reason; a cause outside the test and the library — a compiler bug, an ABI limit, a draft defect — is an expected failure with its reason, and an unexpected pass fails the run so the mark goes when the cause does.

Every test, passing ones included, records its commands, exit statuses and output; each run writes an HTML report with its provenance, and a Markdown copy ready to paste to a person or an assistant.

05

Platform and compiler matrix

GCC 16.2 and Clang 23.1 on Linux and macOS; freestanding checks also cover bare-metal targets.

The matrix distinguishes recorded passes from untested configurations and known gaps, with dates and references to STATUS.md. Modules are tested on Linux only.

Full platform and compiler matrix
Hosted library. Dates are those of the recorded run.
What is verifiedLinux x86_64Ubuntu 24.04, gcc:16 containermacOS 15 arm64Apple Silicon
GCC 16.2.0Clang 23.1.2apt.llvm.orgGCC 16.2.0HomebrewClang 23.1.2LLVM release
Build, freestanding check, CMake package✓ every push✓ every push✓ every push✓ every push
Own suitea✓ 2,723 pass15 xfail✓ 2,698 pass40 xfail✓ 2,743 pass16 xfail✓ 2,717 pass42 xfail
libc++ and libstdc++ suites, sample✓ every push✓ every push——
libc++ and libstdc++ suites, wholeb7,494 / 6,206 passfailures triaged7,495 / 6,161 passfailures triaged; libstdc++ projectedNightly job, no recorded resultfNightly job, no recorded resultf
AddressSanitizere—no ASan runtime in this GCC build✓ own suiteUBSan with it nightly——
ThreadSanitizere✓ own suite✓ own suite——
Hardened, -fno-exceptionsc✓ ✓✓ ✓——
Real-world projectsd✓ 19 of 19✓ 19 of 19under ASan: 19; under TSan: 5——

Linux on aarch64 and other architectures: not built or tested. — means not run.

Freestanding and bare metal
TargetCompilerWhat is checked
x86_64-unknown-none-elf, riscv64-unknown-elfClang 23.1✓ every freestanding header compiles; the smoke test links
x86_64, freestandingGCC 16.2✓ every freestanding header compiles; the smoke test links
Bare x86_64 kernel, Limine in QEMU 8.2GCC 16.2, Clang 23.1✓ boots and passes: containers, std::print and exceptions over the program’s own heap and consoleg
Darwin arm64 and x86_64Clang 23.1Cross-compiled only: every core header and the freestanding runtime compile for both Darwin targets
  1. a CI run of 2026-10-07 (commit d48ba32), 2,824 tests; no failures. Expected failures carry their cause in the test (compiler gaps, ABI limits, a draft defect); the rest are unsupported in that configuration.
  2. b Full runs of 2026-10-05/06 recorded in STATUS.md: 211 and 215 libc++ failures, 13 libstdc++ failures per compiler, each categorised in the suites’ TRIAGE.md. The Clang libstdc++ figure is projected from the full run with the final skip lists. The CI sample (selected directories) passes on every push.
  3. c Own suite, runs of 2026-10-05 recorded in STATUS.md: hardened 2,425 / 2,418 pass and -fno-exceptions 1,941 pass, no failures. The nightly also runs -O2, for which STATUS.md records no result.
  4. d Runs of 2026-10-07 recorded in STATUS.md, with the linkage proof for every project.
  5. e ASan and TSan: whole own suite, 2026-10-06, no failures (GCC TSan with a GCC built with libsanitizer). The nightly ASan job also enables UBSan; STATUS.md records the ASan run.
  6. f The nightly workflow runs both external suites on macOS; STATUS.md records no macOS result yet, and named locales and <stacktrace> symbolization are less exercised there.
  7. g examples/hosted-layers, run by the CMake package test on Linux.
06

Getting started

From an empty directory to import std; with libycxx, on Linux or macOS. You need git, CMake 3.28 or later, Ninja, curl and the host’s C toolchain (the Xcode Command Line Tools on macOS, build-essential or its equivalent on Linux). Nothing else has to be installed first.

shell
mkdir hello && cd hello
curl -fsSL --remote-name-all https://raw.githubusercontent.com/yrashk/libycxx/main/examples/quickstart/{CMakeLists.txt,hello.cpp}
cmake -B build -G Ninja
cmake --build build
./build/hello

It prints ["import", "modules", "std"]. The example fetches libycxx, provisions Clang 23 if needed (about a 2 GB download), and builds the modules and program. Later builds reuse the compiler cache.

The quick-start guide explains the example files, cache, and options. These commands run as written in CI.

What happens during the first build

What the commands do

  • Fetch libycxx. Before project(), CMakeLists.txt gets libycxx with FetchContent (a shallow clone of main; a release tag will replace it) and selects its toolchain file, cmake/ycxx-toolchain.cmake.
  • Provision Clang 23. The toolchain file looks for Clang 23.1 in its cache (~/.local/share/ycxx/toolchains), then on PATH and in Homebrew. When there is none, it downloads LLVM’s 23.1.2 release (a 2 GB download; Linux x86_64 and arm64, macOS on Apple silicon) into the cache, where every later project finds it.
  • Build the std modules. cmake --build compiles what hello needs from libycxx: libycxx.a, its ABI runtime, and the std and std.compat modules with the project’s own flags.
  • Build and run hello. It links libycxx and its runtime, not libstdc++ or libc++.

The first run took 3 minutes on a Linux x86_64 test machine with a fast connection: 15 seconds to download Clang, 2.5 minutes to extract it (0.8 GB of the release is kept), 20 seconds to build with 2 jobs. Later runs, and other projects, reuse the downloaded Clang.

These commands are tested as written: tests/quickstart/run.sh runs them from an empty directory against the commit under test and checks the output, with both compilers on every CI run (the cmake stage of tools/test, Linux and macOS), and with Clang downloaded into an empty cache every night (the quickstart job of the full workflow, Linux and macOS).

Use GCC instead

GCC instead of Clang

shell
cmake -B build -G Ninja -DYCXX_COMPILER=gcc

This uses GCC 16.2 when it is installed (g++-16, Homebrew’s gcc). Without one, it builds GCC from source into the cache, once, which takes about an hour on four cores; on macOS, brew install gcc first is quicker.

Static or shared

By default libycxx is linked statically: every program and shared library gets its own copy, runtime included. Its shared library, libycxx.so.0.<minor> (libycxx.0.<minor>.dylib on macOS), gives them one runtime instead. Choose it for a program that loads plugins, or one made of several libraries that throw exceptions and install handlers across each other.

shell
cmake -B build -G Ninja -DYCXX_SHARED=ON -DYCXX_STATIC=OFF

With an installation built with -DYCXX_SHARED=ON, link ycxx::shared instead of ycxx::ycxx.

Existing projects

Use an installed libycxx through CMake’s find_package, its toolchain file, or compiler wrappers. Building projects covers CMake, Meson, make, autotools, Bazel, Conan, and vcpkg.

Build every C++ dependency from source against the same libycxx installation: prebuilt libstdc++ or libc++ dependencies have a different ABI. C libraries are fine.

07

Status and limitations

Every C++26 header is in place. Version 0.1.0 is still early: the ABI and implementation continue to evolve.

  • Young, without a stable ABI

    No stable ABI yet: rebuild your program and C++ dependencies when libycxx changes, and keep an installation per compiler. The shared library is versioned, libycxx.so.0.<minor>; images built against different versions stop in one process with a message naming both, instead of misbehaving.

  • C++26 only

    Older language modes are raised to C++26. Removed facilities and compiler-library extensions are not supported.

  • Static: one runtime per image

    With the static archives, each program and shared library has its own runtime state: exception state, terminate handlers, and new handlers do not cross their boundaries. The shared library gives them one.

  • Compiler gaps

    Reflection and contracts need GCC support. GCC cannot mix standard header includes and import std; in one translation unit.

  • macOS is newer

    Darwin-specific facilities are less exercised. Stacktrace symbolization reads ELF/DWARF; modules are tested on Linux only.

  • Open work

    External-suite failures, missing hosted-layer primitives, and performance gaps are recorded in the status report.

STATUS.md is the full record: per-area results, known compiler gaps, the draft defects noticed along the way, and what comes next.