Status: Accepted
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.
-std=c++2a, -std=c++20, and -std=gnu++20 are
three different strings that dowel cannot tell apart, cannot validate, and
cannot compare. A typo reaches the compiler and comes back in the
compiler’s words, not the manifest’scxx_flags merges with append,
so a library requiring C++20 and a consumer asking for C++17 produce
-std=c++20 -std=c++17 — the last one wins, silently compiling the
library’s C++20 headers under C++17docs/99-open-questions.md) lists the C++ standard version as a candidate
component of the label. A flag string inside a list cannot be a component
of anythingc_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:
must_equal would fail the
build over a non-problemThe 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).
gnu++20) are deliberately outside the vocabulary. A
dialect is a different axis from a standard version and cannot be placed
in one total order; cxx_flags = ["-std=gnu++20"] remains the way to ask
for one, and it overrides the typed property by positionmax is a general rule, not a special case for standards: it applies to
any property whose domain is a closed ordered vocabulary. PropDef grew a
domain field, which supplies both the validation set and the orderabi keeps must_equal. The two rules coexist because they answer
different questions: an ABI label must be identical to be compatible,
while a standard version must merely be sufficient