skip to content

What are C++26's headline features, and what is its standardisation and compiler-support status in 2026?

level: juniorimportance: nice to knowfreq 30%

answer

  1. reflection, contracts, execution
  2. safety: erroneous behaviour, hardening
  3. N5050 is the final draft
  4. __cplusplus 202603L
  5. flags still experimental

basics

~20 s

C++26 adds static reflection, contracts and the std::execution async model, plus erroneous behaviour, a hardened library, #embed, pack indexing and std::inplace_vector. WG21 finished it in 2026; ISO publication is pending and compiler support is partial.

solid answer

~40 s

The three headline features are **static reflection** (`^^`, `std::meta::info`, splicing with `[: :]`), **contracts** (`pre`, `post`, `contract_assert`) and **`std::execution`**, a sender/receiver model for asynchronous work. Safety work adds **erroneous behaviour** for reads of uninitialized locals and a **hardened standard library** whose precondition checks terminate instead of causing undefined behaviour. Smaller additions include `#embed`, pack indexing (`Ts...[0]`) and `std::inplace_vector`. Status: WG21 finished C++26 in 2026; N5050 is the final draft and the basis of the Draft International Standard, with `__cplusplus` set to `202603L`, and ISO publication is pending. Support is partial: GCC 16 offers reflection and contracts only as experimental options, and Apple clang 21 has pack indexing and `#embed` but neither reflection nor contracts.

code

cpp · 19 lines
cpp
#include <cstdio>

template <typename... Ts>
auto first_and_last(Ts... args) {
    // C++26 pack indexing: args...[I] names the I-th element of the pack
    return args...[0] + args...[sizeof...(Ts) - 1];
}

template <typename... Ts>
using last_t = Ts...[sizeof...(Ts) - 1];

static constexpr unsigned char blob[] = {
#embed "data.bin"
};

int main() {
    last_t<int, double> d = first_and_last(1, 2, 40.5);
    std::printf("%.1f %zu %c\n", d, sizeof blob, blob[0]);
}

go deeper

for a junior

Name C++26's three headline features — reflection, contracts and std::execution — and know it is finished by the committee but not yet in every compiler.

for a middle

Explain each headline in one or two sentences and the smaller additions such as pack indexing and inplace_vector, with the feature-test macro you would check.

for a senior

Give a toolchain-by-toolchain picture of what works today and which experimental flags it needs, and say what you would let into production now.

for a principal

Turn C++26 into an adoption plan: which features justify early use behind flags, which wait for stable support, and which trigger reopens the decision.

## Where C++26 stands **C++26** is the revision after C++23 on the committee's three-year train. WG21 completed it in 2026: the editors' report N5051 describes **N5050** as the final draft for C++26, the basis of the **Draft International Standard** ballot and the starting draft for C++29, and records that `__cplusplus` was updated to **`202603L`**. Until ISO publishes it, C++23 remains the latest published standard, and every C++26 feature should be described as C++26 rather than as what compilers do. ## The headline features | Feature | What it does | Spelling | |---|---|---| | Static reflection | inspect and generate code at compile time | `^^T`, `std::meta::info`, `[: r :]`, `<meta>` | | Contracts | state preconditions, postconditions and assertions the implementation can check | `pre(...)`, `post(...)`, `contract_assert(...)` | | `std::execution` | compose asynchronous work as senders, receivers and schedulers | `<execution>` | | Erroneous behaviour | reading an uninitialized local is no longer undefined behaviour | language rule; `[[indeterminate]]` opts out | | Hardened library | checked preconditions on `operator[]`, `front()` and similar | implementation-defined hardened mode | Reflection and contracts are the features most likely to change how code is written; `std::execution` matters most to teams building asynchronous libraries; the safety items change what bugs cost in production. ## Smaller additions - **Pack indexing**: `Ts...[0]` names the first type of a pack and `args...[I]` the I-th function argument, replacing recursive templates and `std::tuple_element` tricks. - **`#embed "file"`**: the preprocessor expands a binary file into a comma-separated list of integers, so a resource no longer needs a code generator; parameters such as `limit(...)` and `if_empty(...)` control it, and `__has_embed` tests for it. - **`std::inplace_vector<T, N>`**: a vector with fixed capacity `N` stored inside the object, never allocating; growing past `N` throws `std::bad_alloc`, and `try_push_back` instead returns an empty `std::optional<T&>`. ## What can break when moving to C++26 The compatibility annex of N5050 lists the C++23 code that C++26 rejects or changes. The items most likely to matter: - **`contract_assert`** becomes a keyword, and `^^` and `:]` become tokens; - arithmetic mixing two different enumeration types, or an enumeration and a floating-point value, is ill-formed; - comparing two **arrays** with `==` or `<`, which compared addresses, is ill-formed; - `delete` on a pointer to an **incomplete class** is ill-formed instead of undefined; - `T...[n]` in a parameter list now means pack indexing; - library removals: `<codecvt>`, `<strstream>`, `std::wstring_convert`, the free-function atomic API for `std::shared_ptr`, and `basic_string::reserve()` with no argument; the floating-point `std::to_string` output also changed. ## Compiler support in 2026 Support arrives feature by feature, as with every revision: - **GCC 16** accepts `-std=c++26` and documents it as highly experimental. Reflection needs `-freflection` and contracts `-fcontracts`, both described as experimental. In C++26 mode GCC zero-initializes automatic variables by default, its implementation of erroneous behaviour. - **libstdc++ 16** ships `<meta>`, `<contracts>` and `<inplace_vector>`, but its `<execution>` still holds only the C++17 parallel-algorithm policies. - **libc++** for LLVM 23 lists `std::inplace_vector`, `std::execution`, contracts, standard library hardening and reflection as not yet implemented, although it has its own pre-standard hardening modes. - **Apple clang 21**, used to check this answer, compiles pack indexing and `#embed` (warning that `#embed` is a Clang extension), rejects `pre` and `^^`, has no `<inplace_vector>`, and reports `__cplusplus` as `202400L` in `-std=c++2c` mode — a provisional value, not `202603L`. ## Briefing a team A useful briefing answers four questions: 1. **What changes for us?** Usually contracts and hardening first, because they are about correctness; reflection later, where it can replace macros or code generators. 2. **Which toolchains have it?** A per-feature table across every compiler and standard library in the build, from vendor status pages and the feature-test macros such as `__cpp_impl_reflection`, `__cpp_contracts` and `__cpp_lib_inplace_vector`. 3. **What can we use now?** Pack indexing and `#embed` are already usable on some toolchains; library hardening is available today through vendor modes. 4. **When do we revisit?** Tie the next decision to a trigger, such as a compiler release that ships a feature without an experimental flag.

  • Why does a compiler in -std=c++2c mode report a __cplusplus value lower than 202603L?
    The value `202603L` was set in the final draft; a compiler's C++2c mode tracks a moving draft and implements only part of it, so it reports a provisional number — Apple clang 21 reports `202400L`. Code must not test `__cplusplus >= 202603L` to detect individual C++26 features; it should test the feature-test macro for each one, such as `__cpp_pack_indexing`.
  • Which C++26 features could a team use in production in 2026?
    Those its toolchains ship without an experimental flag, verified per compiler: pack indexing and `#embed` on current Clang, and library hardening through vendor modes such as libc++'s `_LIBCPP_HARDENING_MODE`. Reflection and contracts still sit behind experimental GCC options, and `std::execution` is missing from both major open-source standard libraries, so those stay in prototypes.

  • ISO has already published C++26, so it replaced C++23 as the current standard.
  • Every current compiler fully supports C++26 reflection and contracts.
  • C++26 reflection adds runtime metadata to every class.
  • A __cplusplus value of 202400L means all of C++26 is available.
  • std::inplace_vector allocates on the heap once its capacity is exceeded.

Assumes the C++26 final draft N5050 (WG21 finished, ISO publication pending); C++23 is the latest published standard, so support varies by toolchain.