dowel

ADR-0016: The language standard is a typed property merged by maximum

Status: Accepted

Context

Until now the C/C++ standard was written as a raw flag:

[lib.foo.private]
cxx_flags = ["-std=c++20"]

Three things follow from that, none of them good.

Decision

c_std and cxx_std are typed properties of the public / private blocks, each with a closed, ordered vocabulary (c89 … c23, c++98 … c++26). A value outside its vocabulary is the error unknown-standard, with the accepted list and an edit-distance suggestion. The check runs on the written value — including every match arm and when branch — so a misspelling is not deferred until the configuration that selects it.

They merge with a new rule, max: the highest standard reached along the closure wins. This is the correct semantics for a language standard, and it is what must_equal (the abi rule) would get wrong:

The property becomes -std=<value> for its own language only, placed before c_flags / cxx_flags so that an explicitly written -std= still wins (last occurrence wins in both gcc and clang).

Consequences