From b1117a32235934e2164586cb4692ce3e7b603820 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:10:00 -0500 Subject: [PATCH 01/12] Plan the catch-up of the headers and wording to specgen 0.47.0 Seventeen stages, from clearing the docblock errors that now fail the run to producing the draft's own source with the paper applied, with the open decisions and the requests made of specgen. Measured with specgen 0.47.0 against the working draft at 65890fab. --- docs/plan/specgen-catchup.md | 1012 ++++++++++++++++++++++++++++++++++ 1 file changed, 1012 insertions(+) create mode 100644 docs/plan/specgen-catchup.md diff --git a/docs/plan/specgen-catchup.md b/docs/plan/specgen-catchup.md new file mode 100644 index 00000000..2a7473b7 --- /dev/null +++ b/docs/plan/specgen-catchup.md @@ -0,0 +1,1012 @@ +# Plan: specgen-catchup + +**Branch:** `specgen-catchup` (from `upstream/main` at `396d94d`) +**Read first:** the specgen user guide (`~/src/specgen/main/docs/user-guide.md`, +specgen 0.47.0) and `papers/wording/README.md`. +**Depends on:** [#117](https://github.com/bemanproject/expected/pull/117), +which adds `make clean-wording` and regenerates the checked-in wording, with +specgen 0.23.0 and then with 0.41.1 (`b796f6c`). It is open and mergeable. +This plan's stages start from that wording. +**Measured with:** specgen 0.47.0 (`6c50a01`) on the headers at `396d94d`, +which are the headers on `main`, and the working draft at `65890fab` +(2026-11-17), whose `[expected]` is the same as at `3e3793aa` and `2594eff0`. +**Earlier rounds:** 0.23.0, then 0.41.1 (`9d1689d`) on 2026-11-16, then +0.42.3 and 0.43.0 on 2026-11-17 and 18. Where a number moved, the earlier one +is given beside it. + +--- + +## Goal + +Make the generated wording the paper's wording, and make the docblocks say +only what the wording needs said. + +Today there are two texts. `papers/expected-new.tex` is what D4280 proposes, +written and change-marked by hand. `papers/wording/` is what specgen renders +from the header docblocks, and it is the declared source of truth, but it is +not what the paper shows and it is not yet draft form. Nothing checks one +against the other. + +The end state is: + +- the plain render of the headers is the `[expected]` text a working-draft + pull request would carry, front matter included; +- the paper's marked diff is a specgen render against the working draft, so + it cannot lag the headers or the draft; +- `generate --validate --warnings-as-errors` passes, and the notes that + remain have each been read; +- the headers carry no stand-in for something specgen could not do when they + were annotated, and no second copy of text that is generated; +- the API site built from the same docblocks reads them without warnings + ([api-site](#api-site)). + +A further output is now possible and is the last stage: the draft's own +`utilities.tex` with the paper applied, ready to open as a pull request on +the draft ([draft-edit](#draft-edit)). + +## Where this stands with specgen 0.47.0 + +Three things changed since the plan was last measured, and they reorder it. + +**`make wording` fails.** Since 0.44.0 a docblock error fails the run after +the output is written. The seven dead docblocks in `expected` are +docblock errors, so `specgen generate` exits 1 on the headers as they are, +with or without `--validate`. `make wording`, `make wording-check` and +`make papers` all stop there for anyone with a current specgen. +[dead-docblocks](#dead-docblocks) was the third stage and is now the first. + +**The eight requests filed on 2026-11-18 are closed.** Each was rerun here. +Seven do what was asked on these headers. The eighth, a macro standing for +`constexpr`, works on a reduced header and not on `bad_expected_access.hpp`, +for a reason found here: the header ends with +`#undef BEMAN_EXPECTED_CONSTEXPR_EXCEPTION`, and specgen reads the macro as +it stands at the end of the translation unit. See +[macro-specifiers](#macro-specifiers). + +**The plain render moved, in spelling only.** Against the 0.41.1 wording of +#117 it differs in 42 lines over five fragments, and all 42 are one or two of +three changes: `// exposition only` is written `// \expos`, `\exposidnc{name}` in a +listing is written `\exposid{name}`, and the `&` in the title of +`[expected.un.ref]` is escaped. With those three normalized the two renders +are the same, line for line. + +### What specgen gained, and what it does here + +| Since | specgen now | Here | +|---|---|---| +| 0.43.1 | two blank `//!` lines before a note, example, code block, list or table give it its own `\pnum` | available to [converge-with-paper](#converge-with-paper), where the draft numbers a note apart from the paragraph before it | +| 0.44.0 | a docblock error exits 1, after the output is written | the build fails until [dead-docblocks](#dead-docblocks); after it, the gate is real ([warning-gate](#warning-gate)) | +| 0.44.1 | the exposition-only comment is the draft's `// \expos` | 14 lines; one artifact gone from the draft diff | +| 0.44.2 | an index entry around a name reads as the name, in the diff | `\libglobal{name}` on a class head is no longer a mark | +| 0.45.0 | an exposition-only name in a listing is `\exposid`, and takes the baseline's form where the two pair | 40 lines | +| 0.45.1 | `&`, `%`, `#` in prose are escaped for LaTeX; `\&`, `\%`, `\#` are read as the characters | the headers have none in prose | +| 0.45.2 | a backticked span in a section title becomes `\tcode{...}`, escaped | the seven titles can be written as prose is ([section-titles](#section-titles)) | +| 0.45.3 | a specifier spelled through a macro is written as its expansion | not here yet, because of the `#undef` ([macro-specifiers](#macro-specifiers)) | +| 0.45.4 | a declaration whose first token is a macro is placed where it is written | with the macro defined, the constructor and `what()` of `[expected.bad]` stay with their class | +| 0.45.5 | `\asdraft` on a namespace-scope exposition-only declaration inherits by declaration | a second way to state a helper ([helper-placement](#helper-placement)) | +| 0.46.0 | `\impldef{...}`, `\ntbs{}`, `\term{...}`, `\defn{...}`, `\Fundescx{...}` are read in docblocks and from the draft | `what()` can be written as the draft has it ([draft-prose-macros](#draft-prose-macros)); importer warnings fall from 11 to 4 | +| 0.46.1 | more of the mathematics inside a `\tcode` is read | no effect on `[expected]` | +| 0.47.0 | `--apply-to-draft` writes the draft's source with the paper applied | fails on these headers, on the two added subclauses ([draft-edit](#draft-edit)) | +| 0.47.1 | under `--warnings-as-errors`, a warning from reading the draft fails the run | not installed here yet; the 4 importer warnings would fail a draft-diff run that passes the flag ([warning-gate](#warning-gate)) | + +### Tried on a scratch copy of the headers + +Five edits, all markup, none to a declaration: + +- the seven in-class docblocks named by the errors deleted; +- `\expos(has_val)` on the three `has_val_` members; +- the seven section titles that name code written with backticks; +- `what()` written `An \impldef{return value of \tcode{...::what}} \ntbs{},`; +- the trailing `#undef` removed, and + `-D__cpp_lib_constexpr_exceptions=202502L` after the `--`. + +With them `generate --validate --warnings-as-errors` exits 0, with no error, +no warning, and the same 124 notes. The seven titles render with `\tcode`. +`\exposid{has_val}` goes from 0 to 27 and nothing else spells the name. The +macro is gone from the wording (9 lines to 0) and `constexpr` stands in its +place. The draft-diff marks for the two clauses the paper does not touch +fall, as the table below shows. + +## What exists today + +One specgen run over `unexpected.hpp`, `bad_expected_access.hpp` and +`expected.hpp` writes six fragments, and the makefile assembles them into +`papers/wording/expected.tex` in the draft's clause order. `papers/Makefile` +builds `expected-clean.tex` by splicing the hand-written head of +`expected-new.tex` (`[expected.general]`, `[expected.syn]`, markup stripped by +`strip-wording.py`) onto that file. The paper itself `\include`s +`expected-new.tex` and uses no generated text. + +The checked-in wording on `main` is specgen 0.4.0's. #117 carries 0.41.1's. + +### The gap to the paper, measured + +`expected-new.tex` with its markup stripped, against the generated wording, +both from `\rSec2[expected.unexpected]` to the end. The section outline is +identical. Counted by whitespace-separated token, because the paper wraps its +prose by hand and specgen writes a paragraph on one line: + +| | paper | generated, 0.23.0 | generated, 0.41.1 | +|---|---|---|---| +| synopses and item declarations | 3290 | 6623 | 4060 | +| of those, only in the paper | | 823 | 845 | +| of those, only in the generated | | 4156 | 1615 | +| prose | 5565 | 7243 | 7243 | +| of that, only in the paper | | 1883 | 1756 | +| of that, only in the generated | | 3561 | 3434 | + +No header changed between the two columns. The code that only the generated +wording has fell by three fifths from specgen's changes alone. The prose +barely moved, and is where the work now is. + +Not recounted for 0.47.0. The render differs from 0.41.1's only in the three +spellings above, so the prose rows stand and the code rows move by the 14 +comment lines. + +| | paper | 0.23.0 | 0.41.1 and 0.47.0 | +|---|---|---|---| +| lines in synopses and code blocks | 521 | 1238 | 631 | +| comment lines in them | 22 | 194 | 0 | +| lines with `requires` in them | 4 | 150 | 9 | +| *see below* | 43 | 0 | 0 | +| item declarations | 112 | 165 | 165 | +| numbered paragraphs | 339 | 455 | 455 | +| itemized lists | 34 | 12 | 12 | +| `\exposid{unex}` | 120 | 3 | 131, and 136 in 0.47.0 | +| `\tcode{unex}` | 0 | 79 | 0 | +| `\exposid{has_val}` | 34 | 0 | 0 | +| `BEMAN_EXPECTED_DELETE_MSG` | 0 | 25 | 0 | +| `BEMAN_EXPECTED_CONSTEXPR_EXCEPTION` | 0 | 9 | 9 | + +What these say about the render: + +- **Comments.** The implementation's comments are gone from the synopses, and + so are the 22 banner comments, which were never in `// \ref{...}` form. The + synopses have no group headers at all, until + [member-routing](#member-routing) writes them. +- **`requires`.** The 9 that remain are on deleted members that have no item + of their own, where nothing else would state the clause. The paper's 4 are + different ones: the `operator==` templates, which the draft constrains in + the declaration. Those want `\constraints-in-decl`. +- **Exposition names.** `unex` and `val` render as exposition-only names from + the docblocks as they are written. `has_val` does not, because `has_val_` + derives the name *has-val* and the docblocks and the draft write `has_val`. + [exposition-names](#exposition-names) names it. +- **Macros.** A deleted tail renders `= delete;`, and the item declaration of + a deleted member shows it too (16). The macro standing for `constexpr` is + still printed under its own name, 9 times + ([macro-specifiers](#macro-specifiers)). +- Still as before: the implementation's overload set where the paper states + one overload, full `explicit(...)` and `noexcept(...)` conditions where the + draft writes *see below*, and 53 more item declarations than the paper. + +### The gap to the working draft, measured + +`--baseline-draft /source` diffs the generated wording against the +draft's own LaTeX. This is the better yardstick: it compares with the +standard, where the token count above compares with a hand-made copy of it. +Marks in the generated diff, inline added / removed and blocks added / +removed, against the marks the paper makes by hand: + +| clause | 0.41.1 | 0.47.0 | 0.47.0, scratch edits | paper: inline, blocks added | +|---|---|---|---|---| +| `[expected.unexpected]` | 17 / 10, 2 / 2 | 15 / 8, 2 / 2 | 15 / 8, 2 / 2 | 1, 1 | +| `[expected.bad]` | 8 / 12, 5 / 2 | 6 / 10, 5 / 2 | 4 / 7, 5 / 2 | 0, 0 | +| `[expected.bad.void]` | 13 / 8, 0 / 1 | 12 / 7, 0 / 1 | 6 / 0, 0 / 1 | 0, 0 | +| `[expected.expected]` | 160 / 111, 46 / 68 | 158 / 109, 46 / 68 | 156 / 107, 46 / 68 | 7, 3 | +| `[expected.void]` | 124 / 84, 33 / 44 | 121 / 81, 33 / 44 | 116 / 76, 33 / 44 | 7, 3 | +| `[expected.ref]` | all new | all new | all new | all new | + +specgen's own fixes took two or three marks from each clause. The scratch +edits took more from the two small clauses and little from the large ones, +which is the expected shape: the large clauses differ from the draft in what +they declare and how they group it, and no spelling fix reaches that. + +The paper removes nothing, and it does not touch `[expected.bad]` or +`[expected.bad.void]`, so every mark in those two is a difference between the +docblocks and the standard. After the scratch edits, what is left in them is +short enough to list, and each has a stage: + +- the six special members of `bad_expected_access` show `= default` + ([implementation-extras](#implementation-extras)); +- the item for `bad_expected_access::what()` lands at the head of + `[expected.bad]`, ahead of the class synopsis, because its definition + follows that clause's `\rSec` in the header, and `[expected.bad.void]` has + no item for it ([member-routing](#member-routing)); +- the class's opening prose is a `\remarks` stand-in, where the draft has an + unlabelled paragraph ([class-prose](#class-prose)); +- `(\iref{lex.ccon})` is written with parentheses, where `\iref` prints its + own ([draft-prose-macros](#draft-prose-macros)); +- the constructor's parameter is named in the synopsis (`E e` against `E`); +- the `error()` overloads are declared in another order than the draft's, + and the draft states two per item ([synopsis-shape](#synopsis-shape)). + +Elsewhere, as before: `unexpected`'s constructors show the implementation's +`noexcept(...)`, which the draft does not have, and the deduction guide is +missing from `unexpected`'s synopsis. + +One mark is none of these. The draft has `has_error()` on `expected` +and `expected` (P3798R1, in the draft since 2026-07-15). The library +does not, and the paper's `expected-base.tex` predates it, so the diff shows +it as removed. That is recorded under [diff-baseline](#diff-baseline) and is +not this plan's to fix. + +### What validation reports + +`generate --validate` prints 132 lines and exits 1: + +- **7 errors**, all in `expected`: a docblock on the in-class + declaration of a member whose definition also carries one. Only the + definition's is read. The copies have drifted: the copy constructor's + *Remarks* differ between them. Since 0.44.0 these fail the run. +- **124 notes**: a derived *Constraints* or *Mandates* conjunct with no + recognized authored counterpart. They fall into three kinds: a conjunct + that only separates two implementation overloads (`is_reference_v`), an + opaque predicate the prose states in words + (`is-expected-specialization::value`), and the class-level + `static_assert`s against an authored *Mandates* paragraph that states them + in general terms. +- **0 warnings.** + +With `--baseline-draft`, the importer adds 4 warnings of its own (15 in +0.41.1, 11 in 0.42.3): a list item holding a code block in the two +assignment subclauses, and the `floattable` in the two swap subclauses. Both +are [specgen#367](https://github.com/steve-downey/specgen/issues/367), open. + +### Whether it compiles + +`make papers` builds `D4280R0.pdf`, 39 pages, with no undefined reference +and no overfull box. That is the hand-written `expected-new.tex`. + +Nothing compiles the generated wording. Measured with 0.41.1, with +`expected-clean.tex` put in the paper's place on a scratch copy, the build +had one error and 75 overfull boxes, the widest 127pt. The error was the +unescaped `&` in the title of `[expected.un.ref]`, which 0.45.2 escapes. Not +rebuilt with 0.47.0. Of the overfull boxes, 63 were in prose paragraphs, +where a long `\tcode` span does not break, and 12 in item declarations that +wrap later than the paper's. specgen now keeps the draft's line-break hints +(`\brk`, `\-`) where the text is inherited from the draft, and writes none +of its own. + +### What the API site makes of the docblocks + +`make docs` runs Doxygen over the same headers, and the result is published +to GitHub Pages. Doxygen reads `//!` as its own comment form and knows none +of specgen's markers: `ALIASES` in `docs/Doxyfile` is empty. A run prints 615 +warnings, 506 of them for an unknown command: + +| Marker | Times | +|---|---| +| `\effects` | 107 | +| `\at` | 79 | +| `\group` | 73 | +| `\also` | 69 | +| `\constraints` | 59 | +| `\mandates` | 41 | +| `\ensures` | 39 | +| `\merge`, `\hardexpects` | 8 each | +| `\item` | 7 | +| `\expos`, `\expects`, `\omit`, `\iref`, `\elsewhere` | 16 together | + +Each is dropped from the page with the text after it left as running prose, +so a member's *Effects* reads as an untitled sentence and a routing marker's +argument reads as a stray word. See [api-site](#api-site). + +### Stand-ins for what specgen could not do + +What the headers write today, and what they can write instead. + +| In the headers today | Why, where recorded | Now | +|---|---|---| +| `\remarks` on a class for its opening prose | prose before the first tag was an error | unlabelled leading prose; `\synopsis-here` puts the paragraphs before it ahead of the synopsis | +| `\mandates` on a class for its ill-formed paragraph | only that replaced the derived paragraph | leading prose with `\covers mandates P` replaces it, unlabelled | +| `\at` on every member (79) plus banner comments (22) | not recorded | `// \ref{stable.name}, title` routes the members after it, and is the draft's own synopsis comment | +| `[expected.general]`, `[expected.syn]` written by hand in the paper | no prose without a declaration | section prose; a detached `\verbatim-synopsis` in a `.syn` section is rendered as written | +| rationale for an `\omit`ted member kept after the class | the comment above it leaked into the synopsis | dropped from the synopsis; the rationale can go back above the member | +| `\verbatim-synopsis` for `unexpected` | not recorded | in-class definitions reduce to declarations; `\merge` removes a twin | +| no `\seebelow` anywhere | not recorded | `\seebelow explicit`, `\seebelow noexcept` | +| exposition names written `unex`, `val` in docblocks, rendered as plain code | not recorded | either spelling renders as the exposition name, anywhere in a code span | +| section titles naming code as plain text | a title was written out as its source | backticks in a title, as in prose | +| "An implementation-defined ntbs" typed as words | the draft's macros were raw text | `\impldef{...} \ntbs{}`, read as the draft's own | +| `(\iref{x})`, and `\iref` after "Subclause" | not recorded | `\iref{x}` prints its parentheses; `\ref{x}` is the bare reference | +| a macro for `constexpr`, printed under its own name | the synopsis took the spelling | the expansion, once the macro is still defined where specgen reads it | +| `/*** ... */` copies of the draft's synopses at the top of the headers (3) | the reference a reader had | the generated synopsis is the reference ([draft-text-copies](#draft-text-copies)) | +| the paper's diff marked by hand | no diff | `--baseline-draft`, and `--baseline-rev`, `--baseline-header`, `--baseline-ir` | +| unchanged wording retyped into docblocks | no other source | `\asdraft` takes an item's description from the draft; `\asdraft-synopsis` a class's synopsis | +| a pull request on the draft made by hand from `expected-clean.tex` | no other way | `--apply-to-draft`, when it can place a new subclause | + +### Checked against specgen + +The seven scratch headers from the first round of specgen issues, rerun with +0.41.1: + +- Plain comments in a class body are dropped from the synopsis, the one above + an `\omit`ted member included. A `// \ref{x}, title` header and a + `// \syn ...` comment are kept. +- A `requires`-clause stated as *Constraints* is dropped from the synopsis, + and kept under `\constraints-in-decl`. +- `= MACRO("...")`, `= delete("...")` and `= delete` all render `= delete;`. +- Leading prose with `\covers mandates` for each asserted predicate replaces + the derived ill-formed paragraph, and `\synopsis-here` splits the prose + around the synopsis. Without the claims the derived paragraph still + renders, before the prose. +- A detached `\verbatim-synopsis` in a `.syn` section is rendered as written, + with no second namespace, and a declaration after `/// END` is outside the + section. +- `` `value_ == 0` `` and `` `value == 0` `` both render + `\tcode{\exposid{value} == 0}`. +- An undescribed member in a synopsis, and a `\ref` header naming a section + the document does not have, are validation errors that exit 1. + +Still true from the first round: `\seebelow noexcept` masks the condition; a +prose-only `//!` block under an `\rSec` renders as that section's paragraphs; +an umbrella header's gathered `.syn` region folds each class's whole synopsis +into the header synopsis. + +With 0.47.0, on these headers and on a reduced one: + +- A macro whose expansion is `constexpr`, or nothing, is written as its + expansion in a synopsis and in an item declaration, and a definition that + begins with one stays with its class. Add `#undef` of the macro at the end + of the header and it is printed under its own name again. +- A backticked title renders `\tcode{...}`, with `&` escaped inside it. +- `\impldef{...} \ntbs{}` in a docblock renders as the draft's, and the + diff against the draft pairs the two. +- A docblock error exits 1 with the output written; the last line of + standard error says how many findings fail the run. + +## Stages + +Each stage leaves `make wording-check` passing and regenerates the checked-in +wording in the same commit as the header change that caused it. The numbers +are reading order. Stages 1 to 6 are small, are measured above on a scratch +copy, and fit one pull request: after them the run exits 0 under +`--warnings-as-errors`. + +### Stage 1 — [dead-docblocks](#dead-docblocks) + +Clear the 7 errors, which is what lets anything else be built. For each of +the seven members of `expected` (the in-class declarations at +`expected.hpp` lines 3184, 3205, 3374, 3410, 3450, 3533 and 3547), compare +the in-class docblock with the definition's, settle any difference in the +definition's, and delete the in-class copy. Check: no `error:` line from +`generate`, exit status 0, and the `[expected.ref]` fragment changes only +where a difference was settled. + +### Stage 2 — [regenerate](#regenerate) + +Regenerate the checked-in wording with the current specgen, with no header +change, so that every later diff shows one stage's effect and not specgen's. +Against #117's wording this is the 42 lines of spelling described above. +Then turn on [warning-gate](#warning-gate): there are no warnings to fail +it. + +Done once already, for 0.41.1, as the third commit of #117 (`b796f6c`). The +stage recurs whenever specgen changes its render; see +[specgen-pin](#specgen-pin). #117 can merge as it is, with this stage's +commit following it, or take this commit as a fourth. + +### Stage 3 — [gap-yardstick](#gap-yardstick) + +Add a goal that prints both measures: the token difference from the stripped +paper wording, and the marks per clause in the diff against the working +draft. It does not fail the build. It needs a draft checkout +([draft-checkout](#draft-checkout)). Every later stage is judged by what it +does to these numbers. The counts in this plan were made by hand each round, +and the scripts were not kept, which is the reason for the goal. + +### Stage 4 — [exposition-names](#exposition-names) + +`\expos(has_val)` on the three `has_val_` members. Check: `\exposid{has_val}` +goes from 0 to 27 and `\tcode{has_val}` to 0. Move the two `\omit` rationales +back above their members. + +### Stage 5 — [section-titles](#section-titles) + +Write the 7 titles that name code with backticks, as prose does: +``{Partial specialization `unexpected`}``. Check: each renders with +`\tcode{...}` and matches the paper's title. + +### Stage 6 — [draft-prose-macros](#draft-prose-macros) + +Write the draft's own macros where the docblocks now spell their meaning in +words or get them slightly wrong: + +- `what()`, twice: `An \impldef{return value of + \tcode{bad_expected_access::what}} \ntbs{},`, with the index text the + draft has for each; +- `\iref{lex.ccon}` without the parentheses around it, twice, and + `Subclause \ref{expected.unexpected}` for the one `\iref` that follows the + word "Subclause"; +- any `\term`, `\defn` or named requirement the draft uses in text the + docblocks retype, found by reading the draft diff for the marks they leave. + +Check: the marks in `[expected.bad]` and `[expected.bad.void]` fall as in the +scratch column above, and no paragraph of the plain render changes its words. + +### Stage 7 — [macro-specifiers](#macro-specifiers) + +Have the wording show `constexpr` where the header writes +`BEMAN_EXPECTED_CONSTEXPR_EXCEPTION`. Two parts. The run names the expansion +the wording wants ([macro-expansion-args](#macro-expansion-args)). And the +macro has to be defined where specgen reads it, which the trailing `#undef` +prevents: that is a request to specgen, listed below, and the stage waits +for it. Check: the macro appears 0 times in the wording, and +`[expected.bad.void]` is left with the `= default` marks alone. + +### Stage 8 — [member-routing](#member-routing) + +Replace the banner comments with `// \ref{stable.name}, title` group +comments, in the paper's spelling, and drop each `\at` that the group now +implies. `\at` stays where a member sits outside its group, and one is +added: `bad_expected_access::what()` is routed to +`[expected.bad.void]`. Check: item placement is unchanged but for that one, +and the synopses gain the paper's 22 group headers. + +### Stage 9 — [synopsis-shape](#synopsis-shape) + +Bring the class synopses to the draft's shape. What is left of it: + +- `\seebelow explicit` and `\seebelow noexcept` where the paper writes + *see below* (43 occurrences); +- one overload where the implementation has several + ([overload-partitions](#overload-partitions)); +- `\constraints-in-decl` on the `operator==` templates; +- declaration order and grouping where the draft's differs, the `error()` + overloads first; +- `unexpected` tried without its `\verbatim-synopsis`, and the deduction + guide in `unexpected`'s synopsis; +- what the implementation declares beyond the draft + ([implementation-extras](#implementation-extras)). + +Then [draft-text-copies](#draft-text-copies). + +### Stage 10 — [class-prose](#class-prose) + +Rewrite the general subclauses as the draft has them: unlabelled paragraphs +in the draft's order, split around the synopsis with `\synopsis-here`, in +place of the `\remarks` and `\mandates` stand-ins. See +[class-ill-formed-paragraph](#class-ill-formed-paragraph). + +### Stage 11 — [validation-findings](#validation-findings) + +Read the 124 notes and answer each. The three kinds have different answers: + +- an opaque predicate stated in prose gets `\covers`; +- an overload-partition conjunct goes away with + [overload-partitions](#overload-partitions), so this stage follows + [synopsis-shape](#synopsis-shape); +- the class-level ones go away with [class-prose](#class-prose); +- anything left is a real difference between the code and the authored + wording, and is fixed in whichever is wrong. + +### Stage 12 — [front-matter](#front-matter) + +Generate `[expected.general]` and `[expected.syn]`, add them to +`$(WORDING_CLAUSES)`, and retire the head splice in `papers/Makefile` and +`strip-wording.py`'s part in it. See +[header-synopsis-form](#header-synopsis-form). + +### Stage 13 — [exposition-helpers](#exposition-helpers) + +Today the `*.root.tex` fragments hold the exposition-only helpers and are +thrown away, so the generated wording uses `unexpect-dangles-v` and defines +it nowhere. Decide per helper, under [helper-placement](#helper-placement), +whether the wording defines it in the clause that uses it or stops naming it. +`--apply-to-draft` counts these too: it leaves out eight declarations that +are in no subclause, with a warning each. + +### Stage 14 — [api-site](#api-site) + +Make the Doxygen build read the docblocks. Independent of the other stages, +and can go any time after stage 2. See +[api-site-markup](#api-site-markup). Check: no "unknown command" warning +from `make docs`, and an *Effects* paragraph on the page carries its title. + +### Stage 15 — [converge-with-paper](#converge-with-paper) + +Work both [gap-yardstick](#gap-yardstick) measures down. The target for the +draft diff is the paper's own marks: nothing in `[expected.bad]` and +`[expected.bad.void]`, and in the other clauses the additions the paper makes +and no removals. Each remaining difference is settled in the header or in the +paper, whichever is wrong, or written down as intended. The generated wording +also has to compile in the paper's place without overfull boxes; it had 75. +The paper's itemized lists (34 against 12) are the systematic difference +already known to belong here. This is the gate for the next stage: until the +generated diff says what the paper's hand-marked diff says, including it +would change what the paper proposes. + +### Stage 16 — [generated-diff](#generated-diff) + +Render the paper's marked wording with specgen and have `D4280R0.tex` +include that. `expected-new.tex`, `expected-base.tex` and +`strip-wording.py` are retired, and `expected-clean.tex` becomes the plain +render. `--section-number` gives the fragments' headings their draft numbers. +See [diff-baseline](#diff-baseline). + +### Stage 17 — [draft-edit](#draft-edit) + +Produce the draft's `utilities.tex` with the paper applied, with +`--apply-to-draft`, as a goal beside the paper's. See +[draft-pull-request](#draft-pull-request). It waits on specgen and on +[converge-with-paper](#converge-with-paper): an edit of the draft is only as +small as the diff against it. + +## Decisions + +Entry shape: Question / Status / Recommendation or Decision / Why / Log. + +### synopsis-source + +**Question.** Are the class synopses extracted from the class bodies, or +authored with `\verbatim-synopsis`? +**Status.** OPEN +**Recommendation.** Extracted. Nothing in specgen stands in the way now. +**Why.** Extraction is the point of the tool: an authored synopsis is a +second copy of every declaration. specgen now drops from the synopsis the +`requires`-clause it states as *Constraints*, which was the one thing +extraction could not reach, and checks a `\verbatim-synopsis` against its +class under `--validate`, which lowers the cost of the alternative. +`\asdraft-synopsis` is a third form: the draft's synopsis text, with the +specifiers taken from the declarations. It suits a class the paper barely +changes, and none of the three large classes is one. +**Log.** +- 2026-11-16: opened. `requires` in synopses: 150 lines against the paper's 4. +- 2026-11-16: specgen 0.41.1 drops the clause (specgen#281). 9 lines remain, + all on deleted members with no item. +- 2026-11-19: 0.47.0. `bad_expected_access` is a class the paper does + not change, and after the scratch edits its extracted synopsis differs from + the draft's by six `= default` alone. It is the one candidate for + `\asdraft-synopsis`, if [implementation-extras](#implementation-extras) + finds no other way to drop them. + +### overload-partitions + +**Question.** Where the implementation splits one specified overload into +several (trivial and non-trivial, value-`E` and reference-`E`), what does the +wording show? +**Status.** OPEN +**Recommendation.** One overload, as the paper has it: the survivor carries +the wording and each twin is `\merge`d. +**Why.** The paper's synopsis is the specification, and the split is how this +library implements it. specgen's `\merge` drops the conjunct that only +separates a survivor from its twin, but only when the twin states the +other half. The defaulted copy and move constructors here are unconstrained +on purpose, so the survivor's `!(A && B)` has nothing to pair with and its +*Constraints* are authored. +**Log.** +- 2026-11-16: opened. +- 2026-11-19: `--apply-to-draft` names where the split shows against the + draft: one declaration removed from an item and three added in + `[expected.object.cons]`, one removed in `[expected.object.assign]`, two + removed in `[expected.bad]`, and fourteen items added in + `[expected.void.cons]` and `[expected.void.dtor]`, where the draft groups + what the docblocks state one by one. + +### implementation-comments + +**Question.** Where do the implementation's comments in a class body go? +**Status.** DECIDED +**Decision.** They stay where they are, as plain `//`. The synopsis keeps a +`// \ref{...}` group header and a comment marked `// \syn`, and drops the +rest. +**Why.** Not being able to comment inside a class is a burden on the code, +so the fix belonged in the tool. The draft's synopses do carry comments: of +about 4058 comment lines in the library clauses, about five in six are group +headers, `exposition only`, freestanding marks and *see below*, which specgen +reads or writes itself, and about one in six is free text, which is what the +marker is for. +**Decided by.** Steve Downey, 2026-11-16, as the direction for specgen#280. +**Log.** +- 2026-11-16: opened, with 194 comment lines in the synopses against 22. +- 2026-11-16: Steve Downey: filter comments out of the synopsis, perhaps + with markup for any that should be reproduced; not being able to comment + in a class in real code is a real burden. Filed as specgen#280. +- 2026-11-16: specgen 0.41.1 does this. 0 comment lines in the synopses, + with no header change. No comment here needs `\syn` that is known yet. + +### deleted-message-spelling + +**Question.** How does a member deleted through +`BEMAN_EXPECTED_DELETE_MSG("...")` appear in the wording? +**Status.** OPEN +**Recommendation.** Not at all where the paper states the deletion in a +*Remarks* on the enabled overload (`\merge`), and as `= delete;` where the +paper declares the deleted member. +**Why.** The spelling half is settled by specgen: the tail renders +`= delete;` whatever the header writes. What is left is which deleted members +the wording declares at all, and that follows the paper. +**Log.** +- 2026-11-16: opened. The macro appeared 25 times. +- 2026-11-16: specgen 0.41.1 renders `= delete;` (specgen#282). 0 times. +- 2026-11-19: three of the fourteen items `--apply-to-draft` reports as added + in `[expected.void.cons]` are deleted overloads, which the draft does not + declare. + +### class-ill-formed-paragraph + +**Question.** How is a class's "a program that instantiates ... is +ill-formed" paragraph stated? +**Status.** OPEN +**Recommendation.** As the draft's own sentence, in unlabelled leading prose, +with `\covers mandates P` for each `static_assert` it speaks for. +**Why.** The draft writes it as an unlabelled paragraph. The claims keep the +assertions as the evidence the sentence is checked against, and a predicate +the sentence does not cover stays a note. +**Log.** +- 2026-11-16: opened. Only an authored `\mandates` replaced the derived + paragraph, with a label. +- 2026-11-16: specgen 0.41.1 has `\covers mandates` on a class (specgen#283) + and `\synopsis-here`. Recommendation changed from keeping `\mandates`. + +### warning-gate + +**Question.** Does a validation warning fail `make wording` and +`make wording-check`? +**Status.** OPEN +**Recommendation.** Yes: add `--warnings-as-errors` to the specgen call in +the makefile, in [regenerate](#regenerate). Leave it off the goals that read +the draft until specgen#367 is closed. +**Why.** A warning is something specgen verified, and there are none, so the +gate costs nothing and catches the first one. The 124 notes do not fail it +and are worked through in [validation-findings](#validation-findings). +Docblock errors now fail the run by themselves, so the gate no longer has to +look for `error:` on standard error. From 0.47.1 the flag also covers +warnings from reading the draft, and there are 4 of those here that no +header change can clear. +**Log.** +- 2026-11-16: opened. 124 warnings, and specgen exited 0 on warnings. +- 2026-11-16: Steve Downey: warnings and notes need to be distinguished + better; a note is something that has to be checked externally, and some + messages are for things the tool cannot verify. Filed as specgen#285. +- 2026-11-16: specgen 0.41.1: the 124 are notes, and `--warnings-as-errors` + exists and passes. +- 2026-11-19: specgen 0.44.0 exits 1 on a docblock error (specgen#350), so + the run fails today, flag or no flag. On the scratch headers + `--validate --warnings-as-errors` exits 0. + +### header-synopsis-form + +**Question.** How is `[expected.syn]` generated? +**Status.** OPEN +**Recommendation.** A detached `\verbatim-synopsis` in an +`\rSec2[expected.syn]` section of `expected.hpp`, replacing the `/*** */` +copy of the draft text that is there now. +**Why.** The gathered `.syn` region folds each class's full synopsis into the +header synopsis, where the draft has a forward declaration and keeps the +synopsis in the class's own clause. The verbatim form gives the draft's +text, and specgen's guide now names it as the form for a header whose +content is classes. +**Log.** +- 2026-11-16: opened, with two defects in the way. +- 2026-11-16: both fixed in specgen 0.41.1 (specgen#284). + +### draft-text-copies + +**Question.** Do the headers keep the `/*** ... */` copies of the draft's +synopses at the top of the file? +**Status.** OPEN +**Recommendation.** No. Each goes when the generated synopsis of its class +matches the draft's: the two in `bad_expected_access.hpp` after +[synopsis-shape](#synopsis-shape), and the one in `expected.hpp` with +[front-matter](#front-matter), where +[header-synopsis-form](#header-synopsis-form) turns it into the source of +`[expected.syn]`. +**Why.** They were the reference a reader of the header had before there was +generated wording. Now they are a third copy of each synopsis, after the +class body and the generated text, and the only one nothing checks. The +draft diff is the check that the class agrees with the standard. +**Log.** +- 2026-11-19: opened. Three blocks: `bad_expected_access.hpp` lines 18 and + 38, `expected.hpp` line 26. + +### clause-order + +**Question.** Does the makefile keep assembling `expected.tex` in +`$(WORDING_CLAUSES)` order? +**Status.** OPEN +**Recommendation.** Yes. +**Why.** The one divergence it records, `[expected.bad]` before +`[expected.bad.void]`, could be had from an umbrella header's `\rSec` +outline instead, but only together with the gathered synopsis that +[header-synopsis-form](#header-synopsis-form) recommends against. +**Log.** +- 2026-11-16: opened, after the scratch-header check. + +### helper-placement + +**Question.** Where does the wording define an exposition-only helper? +**Status.** OPEN +**Recommendation.** In the clause that first uses it, by opening that +clause's `\rSec` before the helper's declaration, for the helpers the paper +keeps. A helper the paper does not name is restated in the authored wording +instead. +**Why.** A declaration before the first `\rSec` goes to the root fragment, +and the makefile does not assemble those. `reinit_expected` renders there +under its C++ name, as an indexed library function, while the draft shows +*reinit-expected* as code inside `[expected.object.assign]`. +**Log.** +- 2026-11-16: opened. Unchanged in 0.41.1. +- 2026-11-19: 0.45.5 lets `\asdraft` on a namespace-scope exposition-only + declaration inherit the draft's text by its declaration, which would suit + *reinit-expected*, at the price of a draft checkout for the plain render + ([unchanged-wording-source](#unchanged-wording-source)). And + `--apply-to-draft` has no place for a declaration outside every subclause: + it leaves out eight here. Both point the same way as the recommendation. + +### implementation-extras + +**Question.** Where the implementation declares more than the draft +specifies, what does the wording show? +**Status.** OPEN +**Recommendation.** The draft's declaration. How, case by case: +`\seebelow` cannot do it, since the draft has no *see below* there, so it is +`\verbatim-itemdecl` and the synopsis's counterpart, or a request to specgen. +**Why.** The diff against the draft shows three cases in clauses the paper +does not change: a conditional `noexcept` on `unexpected`'s constructors, +`= default` on the special members of `bad_expected_access`, and +`BEMAN_EXPECTED_CONSTEXPR_EXCEPTION` where the draft has `constexpr`. The +first two are permitted strengthenings that are not wording. The third is a +spelling, of the kind specgen#282 settled for `= delete`. +**Log.** +- 2026-11-16: opened, from the first `--baseline-draft` run. +- 2026-11-19: the third case has its own stage, + [macro-specifiers](#macro-specifiers): specgen#349 writes the expansion, + but not for a macro the header `#undef`s. Two cases remain here. A fourth + is small enough to settle with them: the constructor of + `bad_expected_access` names its parameter in the synopsis, and the + draft does not. + +### macro-expansion-args + +**Question.** Which expansion of a configuration macro does the wording +show, and where does the build say so? +**Status.** OPEN +**Recommendation.** The expansion the standard has: `constexpr`, by adding +`-D__cpp_lib_constexpr_exceptions=202502L` to `SPECGEN_CLANG_ARGS`. +**Why.** specgen writes what the macro expands to in the translation unit it +parses, so the wording follows whichever standard library and compiler +specgen's Clang happens to find. Today that is the empty expansion, and the +wording would lose `constexpr` from nine declarations the draft marks with +it. Stating the macro on the command line makes the render the same on every +machine, and the value is the one libstdc++ 16 defines. The cost is that the +wording run and a real build may then parse the header differently, which is +what the option is for. +**Log.** +- 2026-11-19: opened. With the define and the `#undef` removed, on scratch, + the macro appears 0 times and `constexpr` stands in its place. + +### unchanged-wording-source + +**Question.** Is wording the paper does not change authored in the +docblocks, or inherited from the draft with `\asdraft`? +**Status.** OPEN +**Recommendation.** Authored, with the diff against the draft as the check +that it has not drifted. `\asdraft` for an item whose draft text the docblock +cannot state. +**Why.** The docblock is where a reader of the header finds what a member is +specified to do, and an `\asdraft` item says only that the draft has it. +Inheriting also makes the plain render need a draft checkout +(`--inherit-draft`), where today it needs only the headers. Against that, +inheriting is the only way unchanged text cannot drift, and the draft diff +makes drift visible without it. +**Log.** +- 2026-11-16: opened. Not tried on these headers yet. The items the importer + kept as raw LaTeX were the candidates for `\asdraft`: `what()` with + `\impldef` and `\ntbs`, the swap tables, a nested list in the assignment + subclauses. +- 2026-11-19: 0.46.0 reads `\impldef`, `\ntbs` and `\term`, in the draft and + in a docblock, so `what()` is authored + ([draft-prose-macros](#draft-prose-macros)) and is no longer a candidate. + The swap tables and the list holding a code block still are + (specgen#367). + +### draft-checkout + +**Question.** Where does the build find the working draft, and at which +revision? +**Status.** OPEN +**Recommendation.** A make variable naming a draft checkout's `source` +directory, used only by the goals that diff against the draft. The revision +is named in the paper and recorded next to the variable. `make wording` +stays independent of it unless +[unchanged-wording-source](#unchanged-wording-source) goes the other way. +**Why.** specgen records no draft revision; it reads whatever the directory +holds, and lists the files in the depfile. +**Log.** +- 2026-11-16: opened. Numbers against `2594eff0`. +- 2026-11-19: numbers against `65890fab` (2026-11-17), from a + `git archive` of that revision into a scratch directory, since the local + checkout sits at N5054. `utilities.tex` does not differ between + `3e3793aa` and `65890fab`. + +### diff-baseline + +**Question.** What is the baseline for the paper's generated diff? +**Status.** OPEN +**Recommendation.** The working draft, with `--baseline-draft`, at the +revision [draft-checkout](#draft-checkout) names. +**Why.** It is the thing the paper proposes to change, and it needs no +baseline header set and no committed IR, which is what the first +recommendation here had to build. A section the draft lacks, `[expected.ref]` +and `[expected.un.ref]`, renders as all added. The cost is that the diff is +only as clean as the plain render is close to the draft, which is what +[converge-with-paper](#converge-with-paper) is for. +The draft has moved since the paper's base was taken: `has_error()` is in +`[expected.object.obs]` and `[expected.void.obs]`, and the `expected` +synopsis is wrapped in `namespace std`. A diff against today's draft +therefore shows `has_error()` removed until the library and the paper catch +up with P3798R1, or the baseline is pinned to a draft before it. +**Log.** +- 2026-11-16: opened, recommending a baseline header set read through + `--baseline-ir` for R0, since no revision of the annotated headers renders + the working draft (docblocks `85e6712`, 2026-09-08; reference support + `db1c54b`, 2026-07-04). +- 2026-11-16: specgen 0.41.1 has `--baseline-draft`; it runs on these + headers. Recommendation changed. `expected-base.tex` differs from the draft + at `2594eff0` by `has_error()` and the reindented `expected` + synopsis. +- 2026-11-19: 0.47.0. Two artifacts of the comparison are gone + (specgen#353, specgen#354), and the marks per clause are in the table + above. + +### draft-pull-request + +**Question.** Is the paper's change also produced as an edit of the draft's +source? +**Status.** OPEN +**Recommendation.** Yes, as the last stage, once specgen can place an added +subclause. Nothing is built for it before then. +**Why.** It is what the editors apply, and specgen makes it from the same +headers, changing only the bytes that change, so the paper, the clean text +and the pull request cannot disagree. This paper's main content is two new +subclauses, `[expected.ref]` and `[expected.un.ref]`, and placing an added +subclause is the part of specgen#346 not yet done. The run also stops on an +internal error after listing what it cannot place, so nothing is written. +**Log.** +- 2026-11-19: opened. `--apply-to-draft` on the headers as they are: 23 + changes it cannot place (2 added subclauses, 14 added items, 3 added and 4 + removed declarations inside an item), 8 declarations outside every + subclause left out, then + `an edit of bytes 244560 to 244560 overlaps another or runs past the end` + and no file. Most of the 23 are + [overload-partitions](#overload-partitions) and + [synopsis-shape](#synopsis-shape) seen from the draft's side. + +### api-site-markup + +**Question.** How does the API site read docblocks written for specgen? +**Status.** OPEN +**Recommendation.** `ALIASES` in `docs/Doxyfile`: each element tag +(`\effects`, `\constraints`, `\mandates`, `\ensures`, `\expects`, +`\hardexpects`) becomes a titled paragraph, and each marker (`\at`, +`\group`, `\also`, `\merge`, `\omit`, `\expos`, `\elsewhere`) becomes +nothing. Try it first: a Doxygen alias takes its arguments in braces, and +`\at stable.name` passes its argument as the next word, so the markers that +take one may need a filter in place of an alias. +**Why.** The published pages are built from the headers by Doxygen, and +that is not changing in this plan. The docblocks cannot be written for both +readers by hand, so the mapping belongs in configuration. The alternatives +are an `INPUT_FILTER` that rewrites the markers, which handles the +arguments but is a second parser of the markup, and building the reference +pages from specgen's own `mpark` or `org` output, which is a different site. +A set of aliases that specgen shipped would serve every project that uses +it, and is worth asking for once it is known to work here. +**Log.** +- 2026-11-19: opened. 506 unknown-command warnings from `make docs`, by + marker in the table above. + +### specgen-pin + +**Question.** How is the specgen version fixed and recorded? +**Status.** DEFERRED +**Why.** specgen is moving to PyPI and will run through `uv`. The workflow, +the availability test in the makefile, and the pin are revisited then. +**Decided by.** Steve Downey, 2026-11-16. +**Log.** +- 2026-11-16: deferred. +- 2026-11-16: specgen went from 0.23.0 to 0.41.1 within the day, and the + render changed with it. [regenerate](#regenerate) names the version it + used in its commit message until there is a pin. +- 2026-11-17: 0.42.3 installed. Same plain render; only the draft import + changed. +- 2026-11-19: 0.47.0 installed. The render changed in 42 lines, and the exit + status changed: a specgen from 0.44.0 on fails `make wording` on the + headers on `main`, where an older one succeeds. The cost of having no pin + is now a build that works or not by which specgen is on `PATH`. + +## Requests to specgen + +Filed 2026-11-16, each with a scratch-header reproduction. All closed the +same day, and each reproduction rerun against 0.41.1. + +| Request | Issue | Fixed in | For | +|---|---|---|---| +| Synopsis comments are dropped unless marked, those of an `\omit`ted member included | [specgen#280](https://github.com/steve-downey/specgen/issues/280) | `166c598` | [implementation-comments](#implementation-comments) | +| The synopsis drops a `requires`-clause that the item declaration states as *Constraints* | [specgen#281](https://github.com/steve-downey/specgen/issues/281) | `7f0f03f` | [synopsis-source](#synopsis-source) | +| A deleted tail spelled by a macro renders as `= delete` | [specgen#282](https://github.com/steve-downey/specgen/issues/282) | `5457c5e` | [deleted-message-spelling](#deleted-message-spelling) | +| Authored prose can stand for a class's derived ill-formed paragraph | [specgen#283](https://github.com/steve-downey/specgen/issues/283) | `41f6364` | [class-ill-formed-paragraph](#class-ill-formed-paragraph) | +| A detached `\verbatim-synopsis` in a `.syn` section is not wrapped again, and `/// END` closes the section | [specgen#284](https://github.com/steve-downey/specgen/issues/284) | `efc326e` | [header-synopsis-form](#header-synopsis-form) | +| A warning is what specgen verified; a note is what has to be checked outside it | [specgen#285](https://github.com/steve-downey/specgen/issues/285) | `0a849f6` | [warning-gate](#warning-gate) | +| An exposition-only name in an authored code span renders under its exposition name | [specgen#286](https://github.com/steve-downey/specgen/issues/286) | `31f75a4` | [exposition-names](#exposition-names) | + +Filed 2026-11-18, from the 0.41.1 and 0.42.3 runs. All closed, and each +rerun on these headers with 0.47.0: + +| Issue | What | Fixed in | Here | +|---|---|---|---| +| [specgen#348](https://github.com/steve-downey/specgen/issues/348) | A docblock above a definition whose first token is a macro is detached, or its item moves ahead of the class synopsis | 0.45.4 | the constructor of `[expected.bad]` stays with its class when the macro is `constexpr`; the `what()` that still leads the clause is the `` one, a routing matter | +| [specgen#349](https://github.com/steve-downey/specgen/issues/349) | A macro standing for `constexpr` is written into the synopsis under its own name | 0.45.3 | works on a reduced header; not on this one, see below | +| [specgen#350](https://github.com/steve-downey/specgen/issues/350) | A docblock error does not change the exit status | 0.44.0 | exits 1 on the 7 errors | +| [specgen#351](https://github.com/steve-downey/specgen/issues/351) | The LaTeX backend writes a section title as its source text | 0.45.2 | backticked titles render `\tcode{...}` | +| [specgen#352](https://github.com/steve-downey/specgen/issues/352) | `&`, `%` and `#` in docblock prose are written to the LaTeX as they stand | 0.45.1 | the headers have none | +| [specgen#353](https://github.com/steve-downey/specgen/issues/353) | The exposition-only comment is written `// exposition only` | 0.44.1 | 14 lines now `// \expos` | +| [specgen#354](https://github.com/steve-downey/specgen/issues/354) | In a `--baseline-draft` diff, `\libglobal{name}` on a class head reads as a change | 0.44.2 | no mark on the class heads | +| [specgen#355](https://github.com/steve-downey/specgen/issues/355) | The importer keeps `\impldef`, `\ntbs`, `\term`, `\Fundescx`, `floattable`, and a list item holding a code block as raw LaTeX | 0.46.0, in part | 4 warnings left, carried by [specgen#367](https://github.com/steve-downey/specgen/issues/367), open | + +Found 2026-11-19, not filed yet: + +| What | For | +|---|---| +| A specifier macro that the header `#undef`s after its last use is printed under its own name, where the same macro left defined is written as its expansion. The expansion wanted is the one in effect where the macro is used. Reproduction below. | [macro-specifiers](#macro-specifiers) | +| `--apply-to-draft` ends with `an edit of bytes N to N overlaps another or runs past the end` and writes no file, after reporting the changes it cannot place. This belongs on [specgen#346](https://github.com/steve-downey/specgen/issues/346), which is open for placing an added subclause. | [draft-pull-request](#draft-pull-request) | +| A set of Doxygen `ALIASES` for specgen's markers, once [api-site-markup](#api-site-markup) has one that works. | [api-site](#api-site) | + +The reproduction for the first. With `-DUSE_CX` the synopsis reads +`DEMO_CX const char* what() const noexcept;`. Without the `#undef` line it +reads `constexpr const char* what() const noexcept;`. + +```cpp +#ifdef USE_CX + #define DEMO_CX constexpr +#else + #define DEMO_CX +#endif +namespace demo { +// \rSec2[demo.thing]{Thing} +class thing { + public: + DEMO_CX const char* what() const noexcept; +}; + +//! \returns A string. +inline DEMO_CX const char* thing::what() const noexcept { return "x"; } +} // namespace demo +#undef DEMO_CX +``` + +Not filed, and not needed: `\merge` recognizing a distinguishing conjunct +written `!(A && B)`. The defaulted twins here are unconstrained on purpose, +so there is no `A && B` on the twin for it to match. + +## Files touched + +- `include/beman/expected/{unexpected,bad_expected_access,expected}.hpp`: + markup and comments only. No stage changes a declaration's meaning; a stage + that would is a finding, recorded in the decision's log. +- `papers/wording/`: regenerated by every stage. +- `Makefile`, `papers/Makefile`: [regenerate](#regenerate) for the gate, + [gap-yardstick](#gap-yardstick), + [macro-expansion-args](#macro-expansion-args), + [front-matter](#front-matter), [generated-diff](#generated-diff), + [draft-edit](#draft-edit). +- `docs/Doxyfile`: [api-site](#api-site). +- `papers/wording/README.md`: its claim that `[expected.general]` and + `[expected.syn]` cannot be generated goes with + [front-matter](#front-matter). +- `papers/expected-new.tex`, `expected-base.tex`, `strip-wording.py`: + retired by [generated-diff](#generated-diff). + +## Out of scope + +- The specgen installation and pin: [specgen-pin](#specgen-pin). +- Any change to what the paper proposes, `has_error()` included. Where the + headers, the paper and the draft disagree, the disagreement is recorded and + settled on its own. +- The `mpark` and `org` backends. The paper is LaTeX. +- Replacing Doxygen for the API site. + [api-site-markup](#api-site-markup) makes it read the docblocks and goes no + further. +- `split_inline`. The headers already declare in the class and define out of + line, except `unexpected`, whose in-class definitions specgen reduces to + declarations. From 1846970f57895fd9b3a1ee2da03672c99334cb3d Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:10:00 -0500 Subject: [PATCH 02/12] Delete the in-class docblocks of expected that specgen does not read Seven members carried a docblock on the in-class declaration and another on the out-of-line definition. specgen reads the definition's, and since 0.44.0 it reports the other as an error that fails the run, so make wording and make papers stopped there. The render is unchanged. Two of the deleted blocks held text the definitions' do not, on the move constructor and move assignment operator; the next commits settle that. --- include/beman/expected/expected.hpp | 57 ----------------------------- 1 file changed, 57 deletions(-) diff --git a/include/beman/expected/expected.hpp b/include/beman/expected/expected.hpp index d2384888..90b3947b 100644 --- a/include/beman/expected/expected.hpp +++ b/include/beman/expected/expected.hpp @@ -3174,13 +3174,6 @@ class expected { constexpr expected(const expected&) = default; // Copy constructor (non-trivial path) - //! \at expected.ref.cons - //! \effects If `rhs.has_value()` is `true`, initializes `val` with - //! `rhs.val`, so that `*this` and `rhs` refer to the same object; - //! otherwise, initializes `unex` with `rhs.unex`. - //! \ensures `rhs.has_value() == this->has_value()`. - //! \remarks This constructor is defined as deleted unless - //! `is_copy_constructible_v` is `true`. constexpr expected(const expected& rhs) noexcept(std::is_nothrow_copy_constructible_v) requires(std::is_copy_constructible_v && !std::is_trivially_copy_constructible_v); @@ -3194,14 +3187,6 @@ class expected { constexpr expected(expected&&) = default; // Move constructor (non-trivial path) - //! \at expected.ref.cons - //! \effects If `rhs.has_value()` is `true`, initializes `val` with - //! `rhs.val`, so that `*this` and `rhs` refer to the same object; - //! otherwise, initializes `unex` with `std::move(rhs.unex)`. - //! \ensures `rhs.has_value() == this->has_value()`. - //! \remarks The exception specification is equivalent to - //! `is_nothrow_move_constructible_v`. This constructor is defined as - //! deleted unless `is_move_constructible_v` is `true`. constexpr expected(expected&& rhs) noexcept(std::is_nothrow_move_constructible_v) requires(std::is_move_constructible_v && !std::is_trivially_move_constructible_v); @@ -3367,10 +3352,6 @@ class expected { requires std::is_trivially_destructible_v = default; - //! \at expected.ref.dtor - //! \effects If `has_value()` is `false`, destroys `unex`. `T` is not - //! destroyed; `*this` never owns the object it refers to. - //! \remarks This destructor is trivial if `E` is trivially destructible. constexpr ~expected() requires(!std::is_trivially_destructible_v); @@ -3396,17 +3377,6 @@ class expected { = default; // Copy assignment (non-trivial path) - //! \at expected.ref.assign - //! \effects If `rhs.has_value()` is `true`: if `has_value()` is `true`, - //! assigns `rhs.val` to `val`; otherwise destroys `unex` and - //! initializes `val` with `rhs.val`. If `rhs.has_value()` is `false`, - //! the error of `rhs` is assigned to or used to initialize `unex`, as - //! for the primary template. In every case `*this` comes to refer to - //! the object `rhs` refers to, or to hold the error of `rhs`. - //! \returns `*this`. - //! \remarks This operator is defined as deleted unless - //! `is_copy_assignable_v` is `true` and `is_copy_constructible_v` - //! is `true`. constexpr expected& operator=(const expected& rhs) noexcept(std::is_nothrow_copy_constructible_v && std::is_nothrow_copy_assignable_v) requires((std::is_reference_v || (std::is_copy_constructible_v && std::is_copy_assignable_v)) && @@ -3435,18 +3405,6 @@ class expected { = default; // Move assignment (non-trivial path) - //! \at expected.ref.assign - //! \effects If `rhs.has_value()` is `true`: if `has_value()` is `true`, - //! assigns `rhs.val` to `val`; otherwise destroys `unex` and - //! initializes `val` with `rhs.val`. If `rhs.has_value()` is `false`, - //! the error of `rhs` is assigned to or used to initialize `unex`, as - //! for the primary template. - //! \returns `*this`. - //! \remarks The exception specification is equivalent to - //! `is_nothrow_move_constructible_v && - //! is_nothrow_move_assignable_v`. This operator is defined as - //! deleted unless `is_move_assignable_v` is `true` and - //! `is_move_constructible_v` is `true`. constexpr expected& operator=(expected&& rhs) noexcept(std::is_nothrow_move_constructible_v && std::is_nothrow_move_assignable_v) requires((std::is_reference_v || (std::is_move_constructible_v && std::is_move_assignable_v)) && @@ -3521,13 +3479,6 @@ class expected { "expected: cannot assign from unexpected; the value would dangle — use unexpected"); // emplace — rebind the reference - //! \at expected.ref.assign - //! \constraints `is_constructible_v` is `true` and - //! `reference_constructs_from_temporary_v` is `false`. - //! \effects Rebinds `*this` to refer to the object bound by `T& r = - //! std::forward(u);`: if `has_value()` is `false`, destroys `unex` - //! first. Sets `val` to `addressof(r)` and `has_val` to `true`. - //! \returns `*val`. template requires(std::is_constructible_v && !detail::reference_constructs_from_temporary_v) constexpr T& emplace(U&& u) noexcept(std::is_nothrow_constructible_v); @@ -3536,14 +3487,6 @@ class expected { // Swap // ------------------------------------------------------------------------- - //! \at expected.ref.swap - //! \effects Exchanges the states of `*this` and `rhs`. When both hold - //! values, exchanges `val` and `rhs.val` — the referenced objects are - //! not swapped. Otherwise behaves as the primary template's `swap` - //! does for the error. - //! \remarks The exception specification is equivalent to - //! `is_nothrow_move_constructible_v && (is_reference_v || - //! is_nothrow_swappable_v)`. constexpr void swap(expected& rhs) noexcept(std::is_nothrow_move_constructible_v && (std::is_reference_v || std::is_nothrow_swappable_v)) requires((std::is_reference_v || std::is_swappable_v) && std::is_move_constructible_v); From 3882f08a00ab65bea72dbcf9d4f0ec4950340e97 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:10:30 -0500 Subject: [PATCH 03/12] Regenerate the wording with specgen 0.47.0, and fail on a warning No header changed. The render differs from 0.41.1's in three spellings: the exposition-only comment is the draft's `// \expos`, an exposition-only name in a listing is \exposid, and the & in the title of [expected.un.ref] is escaped. The specgen call now passes --warnings-as-errors. There are no warnings, and since 0.44.0 a docblock error fails the run by itself. --- Makefile | 3 +- papers/wording/README.md | 5 ++ papers/wording/expected.tex | 84 +++++++++---------- papers/wording/fragments/expected.bad.tex | 2 +- .../wording/fragments/expected.expected.tex | 26 +++--- papers/wording/fragments/expected.ref.tex | 26 +++--- .../wording/fragments/expected.unexpected.tex | 6 +- papers/wording/fragments/expected.void.tex | 24 +++--- 8 files changed, 91 insertions(+), 85 deletions(-) diff --git a/Makefile b/Makefile index 86ad8639..e8ca24a1 100755 --- a/Makefile +++ b/Makefile @@ -204,7 +204,8 @@ endif # depfile through them, and wording-check passes none. define specgen_wording $(SPECGEN) generate $(WORDING_HEADERS) \ - --backend latex --validate --base-section-depth 2 \ + --backend latex --validate --warnings-as-errors \ + --base-section-depth 2 \ --split $(1) \ --root expected.unexpected.root \ --root expected.bad.root \ diff --git a/papers/wording/README.md b/papers/wording/README.md index 6d65ec5d..21b7791a 100644 --- a/papers/wording/README.md +++ b/papers/wording/README.md @@ -27,6 +27,11 @@ make clean-wording wording `wording` writes them all again. It deletes checked-in files, so it refuses to run when `specgen` is not found, and `make clean` does not reach it. +The run validates the wording and fails on a finding: an error in a docblock, +or a warning, which is something specgen checked and found wrong. The fragments +are written first in either case, so what failed can be read in them. A note +is something specgen cannot check for itself, and does not fail the run. + GNU Make 4.3 or newer. One specgen invocation writes all six fragments, which the makefile states as a grouped target (`&:`) — a rule 4.2 parses as something else entirely, and would then run specgen once per fragment. diff --git a/papers/wording/expected.tex b/papers/wording/expected.tex index dfa1a888..9f314389 100644 --- a/papers/wording/expected.tex +++ b/papers/wording/expected.tex @@ -59,7 +59,7 @@ unexpected& y) noexcept(noexcept(x.swap(y))); private: - E @\exposidnc{unex}@; // exposition only + E @\exposid{unex}@; // \expos }; } \end{codeblock} @@ -215,7 +215,7 @@ \tcode{x.error() == y.error()}. \end{itemdescr} -\rSec3[expected.un.ref]{Partial specialization unexpected} +\rSec3[expected.un.ref]{Partial specialization unexpected} \begin{codeblock} namespace std { @@ -242,7 +242,7 @@ friend constexpr void swap(unexpected& x, unexpected& y) noexcept; private: - E* unex; // exposition only + E* unex; // \expos }; } \end{codeblock} @@ -375,7 +375,7 @@ constexpr const E&& error() const&& noexcept; private: - E @\exposidnc{unex}@; // exposition only + E @\exposid{unex}@; // \expos }; } \end{codeblock} @@ -483,7 +483,7 @@ template class @\libglobal{expected}@ { private: - using @\exposidnc{error-value-type}@ = remove_cv_t>; // exposition only + using @\exposid{error-value-type}@ = remove_cv_t>; // \expos public: using @\libmember{value_type}{expected}@ = T; @@ -553,7 +553,7 @@ template requires(is_reference_v && !is_constructible_v && - !@\exposidnc{unexpect-dangles-v}@) + !@\exposid{unexpect-dangles-v}@) constexpr expected(unexpect_t, Args&&...) = delete; template @@ -632,11 +632,11 @@ template> constexpr T value_or(U&& def) &&; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; template constexpr auto and_then(F&& f) &; template constexpr auto and_then(F&& f) &&; @@ -668,10 +668,10 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposidnc{has-val}@; // exposition only + bool @\exposid{has-val}@; // \expos union { - T @\exposidnc{val}@; // exposition only - unexpected @\exposidnc{unex}@; // exposition only + T @\exposid{val}@; // \expos + unexpected @\exposid{unex}@; // \expos }; }; } @@ -1589,8 +1589,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; \end{itemdecl} \begin{itemdescr} @@ -1609,8 +1609,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; \end{itemdecl} \begin{itemdescr} @@ -1874,7 +1874,7 @@ template class @\libglobal{expected}@ { private: - using @\exposidnc{error-value-type}@ = remove_cv_t>; // exposition only + using @\exposid{error-value-type}@ = remove_cv_t>; // \expos public: using @\libmember{value_type}{expected}@ = void; @@ -1924,7 +1924,7 @@ template requires(is_reference_v && !is_constructible_v && - !@\exposidnc{unexpect-dangles-v}@) + !@\exposid{unexpect-dangles-v}@) constexpr expected(unexpect_t, Args&&...) = delete; template @@ -1983,11 +1983,11 @@ constexpr const E&& error() const&& noexcept; constexpr E&& error() && noexcept; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; template constexpr void value_or(U&&) const = delete; @@ -2018,9 +2018,9 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposidnc{has-val}@; // exposition only + bool @\exposid{has-val}@; // \expos union { - unexpected @\exposidnc{unex}@; // exposition only + unexpected @\exposid{unex}@; // \expos }; }; } @@ -2593,8 +2593,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; \end{itemdecl} \begin{itemdescr} @@ -2613,8 +2613,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; \end{itemdecl} \begin{itemdescr} @@ -2856,7 +2856,7 @@ template class @\libglobal{expected}@ { private: - using @\exposidnc{error-value-type}@ = remove_cv_t>; // exposition only + using @\exposid{error-value-type}@ = remove_cv_t>; // \expos public: using @\libmember{value_type}{expected}@ = T&; @@ -2925,7 +2925,7 @@ template requires(is_reference_v && !is_constructible_v && - !@\exposidnc{unexpect-dangles-v}@) + !@\exposid{unexpect-dangles-v}@) constexpr expected(unexpect_t, Args&&...) = delete; template @@ -2989,11 +2989,11 @@ template> constexpr remove_cv_t value_or(U&& def) const; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; template constexpr auto and_then(F&& f) &; template constexpr auto and_then(F&& f) &&; @@ -3025,10 +3025,10 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposidnc{has-val}@; // exposition only + bool @\exposid{has-val}@; // \expos union { - T* @\exposidnc{val}@; // exposition only - unexpected @\exposidnc{unex}@; // exposition only + T* @\exposid{val}@; // \expos + unexpected @\exposid{unex}@; // \expos }; }; } @@ -3741,8 +3741,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; \end{itemdecl} \begin{itemdescr} @@ -3757,8 +3757,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; \end{itemdecl} \begin{itemdescr} diff --git a/papers/wording/fragments/expected.bad.tex b/papers/wording/fragments/expected.bad.tex index 0adc9512..8db2ed42 100644 --- a/papers/wording/fragments/expected.bad.tex +++ b/papers/wording/fragments/expected.bad.tex @@ -24,7 +24,7 @@ constexpr const E&& error() const&& noexcept; private: - E @\exposidnc{unex}@; // exposition only + E @\exposid{unex}@; // \expos }; } \end{codeblock} diff --git a/papers/wording/fragments/expected.expected.tex b/papers/wording/fragments/expected.expected.tex index 10b88f63..4ae71cd4 100644 --- a/papers/wording/fragments/expected.expected.tex +++ b/papers/wording/fragments/expected.expected.tex @@ -7,7 +7,7 @@ template class @\libglobal{expected}@ { private: - using @\exposidnc{error-value-type}@ = remove_cv_t>; // exposition only + using @\exposid{error-value-type}@ = remove_cv_t>; // \expos public: using @\libmember{value_type}{expected}@ = T; @@ -77,7 +77,7 @@ template requires(is_reference_v && !is_constructible_v && - !@\exposidnc{unexpect-dangles-v}@) + !@\exposid{unexpect-dangles-v}@) constexpr expected(unexpect_t, Args&&...) = delete; template @@ -156,11 +156,11 @@ template> constexpr T value_or(U&& def) &&; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; template constexpr auto and_then(F&& f) &; template constexpr auto and_then(F&& f) &&; @@ -192,10 +192,10 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposidnc{has-val}@; // exposition only + bool @\exposid{has-val}@; // \expos union { - T @\exposidnc{val}@; // exposition only - unexpected @\exposidnc{unex}@; // exposition only + T @\exposid{val}@; // \expos + unexpected @\exposid{unex}@; // \expos }; }; } @@ -1113,8 +1113,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; \end{itemdecl} \begin{itemdescr} @@ -1133,8 +1133,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; \end{itemdecl} \begin{itemdescr} diff --git a/papers/wording/fragments/expected.ref.tex b/papers/wording/fragments/expected.ref.tex index 0b6768d1..f0f0529d 100644 --- a/papers/wording/fragments/expected.ref.tex +++ b/papers/wording/fragments/expected.ref.tex @@ -7,7 +7,7 @@ template class @\libglobal{expected}@ { private: - using @\exposidnc{error-value-type}@ = remove_cv_t>; // exposition only + using @\exposid{error-value-type}@ = remove_cv_t>; // \expos public: using @\libmember{value_type}{expected}@ = T&; @@ -76,7 +76,7 @@ template requires(is_reference_v && !is_constructible_v && - !@\exposidnc{unexpect-dangles-v}@) + !@\exposid{unexpect-dangles-v}@) constexpr expected(unexpect_t, Args&&...) = delete; template @@ -140,11 +140,11 @@ template> constexpr remove_cv_t value_or(U&& def) const; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; template constexpr auto and_then(F&& f) &; template constexpr auto and_then(F&& f) &&; @@ -176,10 +176,10 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposidnc{has-val}@; // exposition only + bool @\exposid{has-val}@; // \expos union { - T* @\exposidnc{val}@; // exposition only - unexpected @\exposidnc{unex}@; // exposition only + T* @\exposid{val}@; // \expos + unexpected @\exposid{unex}@; // \expos }; }; } @@ -892,8 +892,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; \end{itemdecl} \begin{itemdescr} @@ -908,8 +908,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; \end{itemdecl} \begin{itemdescr} diff --git a/papers/wording/fragments/expected.unexpected.tex b/papers/wording/fragments/expected.unexpected.tex index cdeeaf73..05d1ed0a 100644 --- a/papers/wording/fragments/expected.unexpected.tex +++ b/papers/wording/fragments/expected.unexpected.tex @@ -40,7 +40,7 @@ unexpected& y) noexcept(noexcept(x.swap(y))); private: - E @\exposidnc{unex}@; // exposition only + E @\exposid{unex}@; // \expos }; } \end{codeblock} @@ -196,7 +196,7 @@ \tcode{x.error() == y.error()}. \end{itemdescr} -\rSec3[expected.un.ref]{Partial specialization unexpected} +\rSec3[expected.un.ref]{Partial specialization unexpected} \begin{codeblock} namespace std { @@ -223,7 +223,7 @@ friend constexpr void swap(unexpected& x, unexpected& y) noexcept; private: - E* unex; // exposition only + E* unex; // \expos }; } \end{codeblock} diff --git a/papers/wording/fragments/expected.void.tex b/papers/wording/fragments/expected.void.tex index d9f8ed4b..8a8733ab 100644 --- a/papers/wording/fragments/expected.void.tex +++ b/papers/wording/fragments/expected.void.tex @@ -7,7 +7,7 @@ template class @\libglobal{expected}@ { private: - using @\exposidnc{error-value-type}@ = remove_cv_t>; // exposition only + using @\exposid{error-value-type}@ = remove_cv_t>; // \expos public: using @\libmember{value_type}{expected}@ = void; @@ -57,7 +57,7 @@ template requires(is_reference_v && !is_constructible_v && - !@\exposidnc{unexpect-dangles-v}@) + !@\exposid{unexpect-dangles-v}@) constexpr expected(unexpect_t, Args&&...) = delete; template @@ -116,11 +116,11 @@ constexpr const E&& error() const&& noexcept; constexpr E&& error() && noexcept; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; - template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; + template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; template constexpr void value_or(U&&) const = delete; @@ -151,9 +151,9 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposidnc{has-val}@; // exposition only + bool @\exposid{has-val}@; // \expos union { - unexpected @\exposidnc{unex}@; // exposition only + unexpected @\exposid{unex}@; // \expos }; }; } @@ -726,8 +726,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) const&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) const&; \end{itemdecl} \begin{itemdescr} @@ -746,8 +746,8 @@ \indexlibrarymember{error_or}{expected}% \begin{itemdecl} -template - constexpr @\exposidnc{error-value-type}@ error_or(G&& def) &&; +template + constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; \end{itemdecl} \begin{itemdescr} From 0034e47598ad5167cb14315134350f12c5e6680e Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:11:05 -0500 Subject: [PATCH 04/12] State the move members' conditions in expected's grouped Remarks The copy and move constructors are one item, and so are the copy and move assignment operators. Each item's Remarks spoke for the copy member alone. What they said of the move member was in the in-class docblocks that specgen never read: its exception specification, and the condition under which it is deleted. The grouped Remarks now state both. --- include/beman/expected/expected.hpp | 19 +++++++++++++------ papers/wording/expected.tex | 4 ++-- papers/wording/fragments/expected.ref.tex | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/beman/expected/expected.hpp b/include/beman/expected/expected.hpp index 90b3947b..e7b3d358 100644 --- a/include/beman/expected/expected.hpp +++ b/include/beman/expected/expected.hpp @@ -3648,9 +3648,12 @@ class expected { //! `rhs.val`, so that `*this` and `rhs` refer to the same object; //! otherwise, initializes `unex` with `rhs.unex`. //! \ensures `rhs.has_value() == this->has_value()`. -//! \remarks This constructor is trivial if the corresponding constructor -//! of `E` is trivial, and is defined as deleted unless -//! `is_copy_constructible_v` is `true`. +//! \remarks The exception specification of the move constructor is +//! equivalent to `is_nothrow_move_constructible_v`. Each of these +//! constructors is trivial if the corresponding constructor of `E` is +//! trivial. The copy constructor is defined as deleted unless +//! `is_copy_constructible_v` is `true`, and the move constructor unless +//! `is_move_constructible_v` is `true`. template constexpr expected::expected(const expected& rhs) noexcept(std::is_nothrow_copy_constructible_v) requires(std::is_copy_constructible_v && !std::is_trivially_copy_constructible_v) @@ -3838,9 +3841,13 @@ constexpr expected::~expected() //! template. In every case `*this` comes to refer to the object `rhs` //! refers to, or to hold the error of `rhs`. //! \returns `*this`. -//! \remarks This operator is defined as deleted unless -//! `is_copy_assignable_v` is `true` and `is_copy_constructible_v` -//! is `true`. +//! \remarks The exception specification of the move assignment operator is +//! equivalent to `is_nothrow_move_constructible_v && +//! is_nothrow_move_assignable_v`. The copy assignment operator is defined +//! as deleted unless `is_copy_assignable_v` is `true` and +//! `is_copy_constructible_v` is `true`, and the move assignment operator +//! unless `is_move_assignable_v` is `true` and +//! `is_move_constructible_v` is `true`. template constexpr expected& expected::operator=(const expected& rhs) noexcept(std::is_nothrow_copy_constructible_v && diff --git a/papers/wording/expected.tex b/papers/wording/expected.tex index 9f314389..83189344 100644 --- a/papers/wording/expected.tex +++ b/papers/wording/expected.tex @@ -3095,7 +3095,7 @@ \pnum \remarks -This constructor is trivial if the corresponding constructor of \tcode{E} is trivial, and is defined as deleted unless \tcode{is_copy_constructible_v} is \tcode{true}. +The exception specification of the move constructor is equivalent to \tcode{is_nothrow_move_constructible_v}. Each of these constructors is trivial if the corresponding constructor of \tcode{E} is trivial. The copy constructor is defined as deleted unless \tcode{is_copy_constructible_v} is \tcode{true}, and the move constructor unless \tcode{is_move_constructible_v} is \tcode{true}. \end{itemdescr} \indexlibraryctor{expected}% @@ -3433,7 +3433,7 @@ \pnum \remarks -This operator is defined as deleted unless \tcode{is_copy_assignable_v} is \tcode{true} and \tcode{is_copy_constructible_v} is \tcode{true}. +The exception specification of the move assignment operator is equivalent to \tcode{is_nothrow_move_constructible_v \&\& is_nothrow_move_assignable_v}. The copy assignment operator is defined as deleted unless \tcode{is_copy_assignable_v} is \tcode{true} and \tcode{is_copy_constructible_v} is \tcode{true}, and the move assignment operator unless \tcode{is_move_assignable_v} is \tcode{true} and \tcode{is_move_constructible_v} is \tcode{true}. \end{itemdescr} \indexlibrarymember{operator=}{expected}% diff --git a/papers/wording/fragments/expected.ref.tex b/papers/wording/fragments/expected.ref.tex index f0f0529d..3a712948 100644 --- a/papers/wording/fragments/expected.ref.tex +++ b/papers/wording/fragments/expected.ref.tex @@ -246,7 +246,7 @@ \pnum \remarks -This constructor is trivial if the corresponding constructor of \tcode{E} is trivial, and is defined as deleted unless \tcode{is_copy_constructible_v} is \tcode{true}. +The exception specification of the move constructor is equivalent to \tcode{is_nothrow_move_constructible_v}. Each of these constructors is trivial if the corresponding constructor of \tcode{E} is trivial. The copy constructor is defined as deleted unless \tcode{is_copy_constructible_v} is \tcode{true}, and the move constructor unless \tcode{is_move_constructible_v} is \tcode{true}. \end{itemdescr} \indexlibraryctor{expected}% @@ -584,7 +584,7 @@ \pnum \remarks -This operator is defined as deleted unless \tcode{is_copy_assignable_v} is \tcode{true} and \tcode{is_copy_constructible_v} is \tcode{true}. +The exception specification of the move assignment operator is equivalent to \tcode{is_nothrow_move_constructible_v \&\& is_nothrow_move_assignable_v}. The copy assignment operator is defined as deleted unless \tcode{is_copy_assignable_v} is \tcode{true} and \tcode{is_copy_constructible_v} is \tcode{true}, and the move assignment operator unless \tcode{is_move_assignable_v} is \tcode{true} and \tcode{is_move_constructible_v} is \tcode{true}. \end{itemdescr} \indexlibrarymember{operator=}{expected}% From cf465bd02442799d002962393bbc28a1eca4369b Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:12:02 -0500 Subject: [PATCH 05/12] Name has_val as the exposition-only name, and put two rationales back specgen derives the name has-val from has_val_, where the draft and the docblocks write has_val. \expos(has_val) on the three members names it, and the wording now has \exposid{has_val} wherever the name is used. The notes on the deleted copy assignment and on expected's void_ member sat after their classes, because a comment above an omitted member used to be carried into the synopsis. It no longer is, so each is above its member again. Neither changes the wording. --- include/beman/expected/expected.hpp | 65 +++++++++---------- papers/wording/expected.tex | 50 +++++++------- .../wording/fragments/expected.expected.tex | 18 ++--- papers/wording/fragments/expected.ref.tex | 10 +-- papers/wording/fragments/expected.void.tex | 22 +++---- 5 files changed, 81 insertions(+), 84 deletions(-) diff --git a/include/beman/expected/expected.hpp b/include/beman/expected/expected.hpp index e7b3d358..4a8a2043 100644 --- a/include/beman/expected/expected.hpp +++ b/include/beman/expected/expected.hpp @@ -384,6 +384,20 @@ class expected { std::is_trivially_destructible_v && std::is_trivially_copy_constructible_v && std::is_trivially_copy_assignable_v && std::is_trivially_destructible_v)); + // This deleted copy assignment is satisfied exactly when neither the + // trivial nor the non-trivial path above is, so some candidate always is. + // It is here for clang. Clang (17 through at least 24) treats a class + // whose copy-assignment candidates all have unsatisfied constraints as not + // trivially copyable, although none of them is eligible ([special]) and + // [class.prop] counts only eligible ones; gcc gets it right. Without it, + // expected is trivially copyable under gcc and not under + // clang, while libstdc++'s std::expected is under both. A deleted + // candidate is not eligible either, so the triviality it restores is the + // one the standard gives. It is copy assignment only: a satisfied deleted + // move assignment would win overload resolution for an rvalue and stop it + // falling back to copy assignment. expected and expected + // carry the same overload for the same reason. It is not wording, so it + // is `\omit`ted. //! \omit constexpr expected& operator=(const expected&) requires(!(std::is_trivially_copy_constructible_v && std::is_trivially_copy_assignable_v && @@ -639,7 +653,7 @@ class expected { } private: - //! \expos + //! \expos(has_val) bool has_val_; union { //! \expos @@ -649,22 +663,6 @@ class expected { }; }; -// The deleted copy assignment, the `\omit`ted one after the trivial and -// non-trivial paths, is satisfied exactly when neither of them is, so some -// candidate always is. It is here for clang. Clang (17 through at least 24) -// treats a class whose copy-assignment candidates all have unsatisfied -// constraints as not trivially copyable, although none of them is eligible -// ([special]) and [class.prop] counts only eligible ones; gcc gets it right. -// Without it, expected is trivially copyable under gcc and not -// under clang, while libstdc++'s std::expected is under both. A deleted -// candidate is not eligible either, so the triviality it restores is the one -// the standard gives. It is copy assignment only: a satisfied deleted move -// assignment would win overload resolution for an rvalue and stop it falling -// back to copy assignment. expected and expected carry the -// same overload for the same reason. It is not wording, so it is `\omit`ted, -// and a comment on it would be carried into the synopsis, which is why this -// one sits here. - // \rSec3[expected.object.cons]{Constructors} //! \effects Value-initializes `val`. @@ -2248,9 +2246,23 @@ class expected { } private: - //! \expos + //! \expos(has_val) bool has_val_; union { + // `void_` is the value state's active union member. It is not + // exposition-only: the draft's union holds `unex` alone, and specgen + // drops an unmarked alternative from the synopsis. + // + // It is here for gcc. Under -fsanitize=address the use-after-scope + // markers stop gcc forwarding a just-stored `has_val_` to the load + // that guards a later read of `unex_`, so a value-state object whose + // union was never written gets that read reported as + // -Wmaybe-uninitialized. Initializing `void_` in every constructor + // that can end in the value state fixes it: the front end folds the + // constructor to an aggregate, and because an empty member does not + // fill the union, the gimplifier zero-clears the whole object before + // storing the fields, which leaves nothing unwritten. libstdc++'s + // expected carries the same member for the same reason. struct { } void_; //! \expos @@ -2258,21 +2270,6 @@ class expected { }; }; -// `void_` is the value state's active union member. It is not exposition-only -// -- the draft's union holds `unex` alone, and specgen drops an unmarked -// alternative from the synopsis -- and a comment on it would be carried into -// the synopsis, which is why this one sits here. -// -// It is here for gcc. Under -fsanitize=address the use-after-scope markers -// stop gcc forwarding a just-stored `has_val_` to the load that guards a -// later read of `unex_`, so a value-state object whose union was never -// written gets that read reported as -Wmaybe-uninitialized. Initializing -// `void_` in every constructor that can end in the value state fixes it: the -// front end folds the constructor to an aggregate, and because an empty -// member does not fill the union, the gimplifier zero-clears the whole object -// before storing the fields, which leaves nothing unwritten. libstdc++'s -// expected carries the same member for the same reason. - // ============================================================================= // \rSec3[expected.void.cons]{Constructors} @@ -3631,7 +3628,7 @@ class expected { } private: - //! \expos + //! \expos(has_val) bool has_val_; union { //! \expos diff --git a/papers/wording/expected.tex b/papers/wording/expected.tex index 83189344..4f0cfd7f 100644 --- a/papers/wording/expected.tex +++ b/papers/wording/expected.tex @@ -668,7 +668,7 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposid{has-val}@; // \expos + bool @\exposid{has_val}@; // \expos union { T @\exposid{val}@; // \expos unexpected @\exposid{unex}@; // \expos @@ -683,7 +683,7 @@ \pnum \remarks -Any object of type \tcode{expected} either contains a value of type \tcode{T} or a value of type \tcode{E} nested within it. Member \tcode{has_val} indicates whether the \tcode{expected} object contains an object of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. The error is held as an \tcode{unexpected}, and not as an \tcode{E}, so that \tcode{E} may be an lvalue reference type: an \tcode{E\&} cannot be a union member, whereas \tcode{unexpected} holds a pointer to an external object. +Any object of type \tcode{expected} either contains a value of type \tcode{T} or a value of type \tcode{E} nested within it. Member \exposid{has_val} indicates whether the \tcode{expected} object contains an object of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. The error is held as an \tcode{unexpected}, and not as an \tcode{E}, so that \tcode{E} may be an lvalue reference type: an \tcode{E\&} cannot be a union member, whereas \tcode{unexpected} holds a pointer to an external object. \rSec3[expected.object.cons]{Constructors} @@ -1173,7 +1173,7 @@ \pnum \effects -If \tcode{this->has_value() \&\& rhs.has_value()}, equivalent to \tcode{\exposid{val} = *rhs}. Otherwise, if \tcode{this->has_value()}, equivalent to \tcode{reinit-expected(\exposid{unex}, \exposid{val}, rhs.error())}. Otherwise, if \tcode{rhs.has_value()}, equivalent to \tcode{reinit-expected(\exposid{val}, \exposid{unex}, *rhs)}. Otherwise, equivalent to \tcode{\exposid{unex} = rhs.\exposid{unex}}. Then, if no exception was thrown, equivalent to: \tcode{has_val = rhs.has_value(); return *this;} When \tcode{E} is an lvalue reference type, each of the cases above that initializes or assigns \exposid{unex} rebinds it: \exposid{unex} comes to refer to the same object as \tcode{rhs}'s error. No previously or subsequently referenced object is assigned through. +If \tcode{this->has_value() \&\& rhs.has_value()}, equivalent to \tcode{\exposid{val} = *rhs}. Otherwise, if \tcode{this->has_value()}, equivalent to \tcode{reinit-expected(\exposid{unex}, \exposid{val}, rhs.error())}. Otherwise, if \tcode{rhs.has_value()}, equivalent to \tcode{reinit-expected(\exposid{val}, \exposid{unex}, *rhs)}. Otherwise, equivalent to \tcode{\exposid{unex} = rhs.\exposid{unex}}. Then, if no exception was thrown, equivalent to: \tcode{\exposid{has_val} = rhs.has_value(); return *this;} When \tcode{E} is an lvalue reference type, each of the cases above that initializes or assigns \exposid{unex} rebinds it: \exposid{unex} comes to refer to the same object as \tcode{rhs}'s error. No previously or subsequently referenced object is assigned through. \pnum \returns @@ -1235,7 +1235,7 @@ \pnum \effects -If \tcode{this->has_value() \&\& rhs.has_value()}, equivalent to \tcode{\exposid{val} = std::move(*rhs)}. Otherwise, if \tcode{this->has_value()}, equivalent to \tcode{reinit-expected(\exposid{unex}, \exposid{val}, std::move(rhs.error()))}. Otherwise, if \tcode{rhs.has_value()}, equivalent to \tcode{reinit-expected(\exposid{val}, \exposid{unex}, std::move(*rhs))}. Otherwise, equivalent to \tcode{\exposid{unex} = std::move(rhs.\exposid{unex})}. Then, if no exception was thrown, equivalent to: \tcode{has_val = rhs.has_value(); return *this;} When \tcode{E} is an lvalue reference type, each of the cases above that initializes or assigns \exposid{unex} rebinds it: \exposid{unex} comes to refer to the same object as \tcode{rhs}'s error. No previously or subsequently referenced object is assigned through. +If \tcode{this->has_value() \&\& rhs.has_value()}, equivalent to \tcode{\exposid{val} = std::move(*rhs)}. Otherwise, if \tcode{this->has_value()}, equivalent to \tcode{reinit-expected(\exposid{unex}, \exposid{val}, std::move(rhs.error()))}. Otherwise, if \tcode{rhs.has_value()}, equivalent to \tcode{reinit-expected(\exposid{val}, \exposid{unex}, std::move(*rhs))}. Otherwise, equivalent to \tcode{\exposid{unex} = std::move(rhs.\exposid{unex})}. Then, if no exception was thrown, equivalent to: \tcode{\exposid{has_val} = rhs.has_value(); return *this;} When \tcode{E} is an lvalue reference type, each of the cases above that initializes or assigns \exposid{unex} rebinds it: \exposid{unex} comes to refer to the same object as \tcode{rhs}'s error. No previously or subsequently referenced object is assigned through. \pnum \returns @@ -1259,7 +1259,7 @@ \pnum \effects -If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{\exposid{val} = std::forward(v);} Otherwise, equivalent to: \tcode{reinit-expected(\exposid{val}, \exposid{unex}, std::forward(v)); has_val = true;} +If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{\exposid{val} = std::forward(v);} Otherwise, equivalent to: \tcode{reinit-expected(\exposid{val}, \exposid{unex}, std::forward(v)); \exposid{has_val} = true;} \pnum \returns @@ -1281,7 +1281,7 @@ \pnum \effects -If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{reinit-expected(\exposid{unex}, \exposid{val}, e.error()); has_val = false;} Otherwise, equivalent to: \tcode{\exposid{unex} = unexpected(e.error());} +If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{reinit-expected(\exposid{unex}, \exposid{val}, e.error()); \exposid{has_val} = false;} Otherwise, equivalent to: \tcode{\exposid{unex} = unexpected(e.error());} \pnum \returns @@ -1347,7 +1347,7 @@ \pnum \effects -Equivalent to: \tcode{if (has_value()) \{ destroy_at(addressof(\exposid{val})); \} else \{ destroy_at(addressof(\exposid{unex})); has_val = true; \} return *construct_at(addressof(\exposid{val}), std::forward(args)...);} +Equivalent to: \tcode{if (has_value()) \{ destroy_at(addressof(\exposid{val})); \} else \{ destroy_at(addressof(\exposid{unex})); \exposid{has_val} = true; \} return *construct_at(addressof(\exposid{val}), std::forward(args)...);} \end{itemdescr} \indexlibrarymember{emplace}{expected}% @@ -1363,7 +1363,7 @@ \pnum \effects -Equivalent to: \tcode{if (has_value()) \{ destroy_at(addressof(\exposid{val})); \} else \{ destroy_at(addressof(\exposid{unex})); has_val = true; \} return *construct_at(addressof(\exposid{val}), il, std::forward(args)...);} +Equivalent to: \tcode{if (has_value()) \{ destroy_at(addressof(\exposid{val})); \} else \{ destroy_at(addressof(\exposid{unex})); \exposid{has_val} = true; \} return *construct_at(addressof(\exposid{val}), il, std::forward(args)...);} \end{itemdescr} \rSec3[expected.object.swap]{Swap} @@ -1480,7 +1480,7 @@ \begin{itemdescr} \pnum \returns -\tcode{has_val}. +\exposid{has_val}. \end{itemdescr} \indexlibrarymember{value}{expected}% @@ -2018,7 +2018,7 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposid{has-val}@; // \expos + bool @\exposid{has_val}@; // \expos union { unexpected @\exposid{unex}@; // \expos }; @@ -2032,7 +2032,7 @@ \pnum \remarks -Any object of type \tcode{expected} either represents a value of type \tcode{T}, or contains a value of type \tcode{E} nested within it. Member \tcode{has_val} indicates whether the \tcode{expected} object represents a value of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. +Any object of type \tcode{expected} either represents a value of type \tcode{T}, or contains a value of type \tcode{E} nested within it. Member \exposid{has_val} indicates whether the \tcode{expected} object represents a value of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. \rSec3[expected.void.cons]{Constructors} @@ -2348,7 +2348,7 @@ \pnum \effects -If \tcode{this->has_value() \&\& rhs.has_value()}, no effects. Otherwise, if \tcode{this->has_value()}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), rhs.\exposid{unex}); has_val = false;} Otherwise, if \tcode{rhs.has_value()}, destroys \exposid{unex} and sets \tcode{has_val} to \tcode{true}. Otherwise, equivalent to \tcode{\exposid{unex} = rhs.\exposid{unex}}. +If \tcode{this->has_value() \&\& rhs.has_value()}, no effects. Otherwise, if \tcode{this->has_value()}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), rhs.\exposid{unex}); \exposid{has_val} = false;} Otherwise, if \tcode{rhs.has_value()}, destroys \exposid{unex} and sets \exposid{has_val} to \tcode{true}. Otherwise, equivalent to \tcode{\exposid{unex} = rhs.\exposid{unex}}. \pnum \returns @@ -2372,7 +2372,7 @@ \pnum \effects -If \tcode{this->has_value() \&\& rhs.has_value()}, no effects. Otherwise, if \tcode{this->has_value()}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), std::move(rhs.\exposid{unex})); has_val = false;} Otherwise, if \tcode{rhs.has_value()}, destroys \exposid{unex} and sets \tcode{has_val} to \tcode{true}. Otherwise, equivalent to \tcode{\exposid{unex} = std::move(rhs.\exposid{unex})}. +If \tcode{this->has_value() \&\& rhs.has_value()}, no effects. Otherwise, if \tcode{this->has_value()}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), std::move(rhs.\exposid{unex})); \exposid{has_val} = false;} Otherwise, if \tcode{rhs.has_value()}, destroys \exposid{unex} and sets \exposid{has_val} to \tcode{true}. Otherwise, equivalent to \tcode{\exposid{unex} = std::move(rhs.\exposid{unex})}. \pnum \returns @@ -2398,7 +2398,7 @@ \pnum \effects -If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), e.error()); has_val = false;} Otherwise, equivalent to: \tcode{\exposid{unex} = unexpected(e.error());} +If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), e.error()); \exposid{has_val} = false;} Otherwise, equivalent to: \tcode{\exposid{unex} = unexpected(e.error());} \pnum \returns @@ -2459,7 +2459,7 @@ \begin{itemdescr} \pnum \effects -If \tcode{has_value()} is \tcode{false}, destroys \exposid{unex} and sets \tcode{has_val} to \tcode{true}. +If \tcode{has_value()} is \tcode{false}, destroys \exposid{unex} and sets \exposid{has_val} to \tcode{true}. \end{itemdescr} \rSec3[expected.void.swap]{Swap} @@ -2515,7 +2515,7 @@ \begin{itemdescr} \pnum \returns -\tcode{has_val}. +\exposid{has_val}. \end{itemdescr} \indexlibrarymember{operator*}{expected}% @@ -2748,7 +2748,7 @@ \pnum \effects -If \tcode{has_value()} is \tcode{false}, returns \tcode{expected(unexpect, error())}. Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an \tcode{expected} object whose \tcode{has_val} member is \tcode{true} and \tcode{val} member is direct-non-list-initialized with \tcode{invoke(std::forward(f))}. Otherwise, evaluates \tcode{invoke(std::forward(f))} and then returns \tcode{expected()}. +If \tcode{has_value()} is \tcode{false}, returns \tcode{expected(unexpect, error())}. Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an \tcode{expected} object whose \exposid{has_val} member is \tcode{true} and \tcode{val} member is direct-non-list-initialized with \tcode{invoke(std::forward(f))}. Otherwise, evaluates \tcode{invoke(std::forward(f))} and then returns \tcode{expected()}. \end{itemdescr} \indexlibrarymember{transform}{expected}% @@ -2770,7 +2770,7 @@ \pnum \effects -If \tcode{has_value()} is \tcode{false}, returns \tcode{expected(unexpect, std::move(error()))}. Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an \tcode{expected} object whose \tcode{has_val} member is \tcode{true} and \tcode{val} member is direct-non-list-initialized with \tcode{invoke(std::forward(f))}. Otherwise, evaluates \tcode{invoke(std::forward(f))} and then returns \tcode{expected()}. +If \tcode{has_value()} is \tcode{false}, returns \tcode{expected(unexpect, std::move(error()))}. Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an \tcode{expected} object whose \exposid{has_val} member is \tcode{true} and \tcode{val} member is direct-non-list-initialized with \tcode{invoke(std::forward(f))}. Otherwise, evaluates \tcode{invoke(std::forward(f))} and then returns \tcode{expected()}. \end{itemdescr} \indexlibrarymember{transform_error}{expected}% @@ -2788,7 +2788,7 @@ \pnum \returns -If \tcode{has_value()} is \tcode{true}, \tcode{expected()}; otherwise, an \tcode{expected} object whose \tcode{has_val} member is \tcode{false} and \exposid{unex} member is direct-non-list-initialized with \tcode{invoke(std::forward(f), error())}. +If \tcode{has_value()} is \tcode{true}, \tcode{expected()}; otherwise, an \tcode{expected} object whose \exposid{has_val} member is \tcode{false} and \exposid{unex} member is direct-non-list-initialized with \tcode{invoke(std::forward(f), error())}. \end{itemdescr} \indexlibrarymember{transform_error}{expected}% @@ -2806,7 +2806,7 @@ \pnum \returns -If \tcode{has_value()} is \tcode{true}, \tcode{expected()}; otherwise, an \tcode{expected} object whose \tcode{has_val} member is \tcode{false} and \exposid{unex} member is direct-non-list-initialized with \tcode{invoke(std::forward(f), std::move(error()))}. +If \tcode{has_value()} is \tcode{true}, \tcode{expected()}; otherwise, an \tcode{expected} object whose \exposid{has_val} member is \tcode{false} and \exposid{unex} member is direct-non-list-initialized with \tcode{invoke(std::forward(f), std::move(error()))}. \end{itemdescr} \rSec3[expected.void.eq]{Equality operators} @@ -3025,7 +3025,7 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposid{has-val}@; // \expos + bool @\exposid{has_val}@; // \expos union { T* @\exposid{val}@; // \expos unexpected @\exposid{unex}@; // \expos @@ -3040,7 +3040,7 @@ \pnum \remarks -An object of type \tcode{expected} either represents a reference to an object of type \tcode{T}, or holds an error. Member \tcode{has_val} indicates whether the object represents a reference. When it represents a reference, member \exposid{val} points to the referenced object, which is not owned by the \tcode{expected} object. Otherwise, the error is \tcode{\exposid{unex}.error()}. +An object of type \tcode{expected} either represents a reference to an object of type \tcode{T}, or holds an error. Member \exposid{has_val} indicates whether the object represents a reference. When it represents a reference, member \exposid{val} points to the referenced object, which is not owned by the \tcode{expected} object. Otherwise, the error is \tcode{\exposid{unex}.error()}. \rSec3[expected.ref.cons]{Constructors} @@ -3472,7 +3472,7 @@ \pnum \effects -Let \tcode{r} be the lvalue result of \tcode{T\& r = std::forward(u);}. If \tcode{has_value()} is \tcode{true}, assigns \tcode{addressof(r)} to \exposid{val}. Otherwise, destroys \exposid{unex}, initializes \exposid{val} with \tcode{addressof(r)}, and sets \tcode{has_val} to \tcode{true}; if binding \tcode{r} throws, \tcode{*this} is left unchanged. +Let \tcode{r} be the lvalue result of \tcode{T\& r = std::forward(u);}. If \tcode{has_value()} is \tcode{true}, assigns \tcode{addressof(r)} to \exposid{val}. Otherwise, destroys \exposid{unex}, initializes \exposid{val} with \tcode{addressof(r)}, and sets \exposid{has_val} to \tcode{true}; if binding \tcode{r} throws, \tcode{*this} is left unchanged. \pnum \returns @@ -3556,7 +3556,7 @@ \pnum \effects -Rebinds \tcode{*this} to refer to the object bound by \tcode{T\& r = std::forward(u);}: if \tcode{has_value()} is \tcode{false}, destroys \exposid{unex} first. Sets \exposid{val} to \tcode{addressof(r)} and \tcode{has_val} to \tcode{true}. +Rebinds \tcode{*this} to refer to the object bound by \tcode{T\& r = std::forward(u);}: if \tcode{has_value()} is \tcode{false}, destroys \exposid{unex} first. Sets \exposid{val} to \tcode{addressof(r)} and \exposid{has_val} to \tcode{true}. \pnum \returns @@ -3650,7 +3650,7 @@ \begin{itemdescr} \pnum \returns -\tcode{has_val}. +\exposid{has_val}. \end{itemdescr} \indexlibrarymember{value}{expected}% diff --git a/papers/wording/fragments/expected.expected.tex b/papers/wording/fragments/expected.expected.tex index 4ae71cd4..244489c0 100644 --- a/papers/wording/fragments/expected.expected.tex +++ b/papers/wording/fragments/expected.expected.tex @@ -192,7 +192,7 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposid{has-val}@; // \expos + bool @\exposid{has_val}@; // \expos union { T @\exposid{val}@; // \expos unexpected @\exposid{unex}@; // \expos @@ -207,7 +207,7 @@ \pnum \remarks -Any object of type \tcode{expected} either contains a value of type \tcode{T} or a value of type \tcode{E} nested within it. Member \tcode{has_val} indicates whether the \tcode{expected} object contains an object of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. The error is held as an \tcode{unexpected}, and not as an \tcode{E}, so that \tcode{E} may be an lvalue reference type: an \tcode{E\&} cannot be a union member, whereas \tcode{unexpected} holds a pointer to an external object. +Any object of type \tcode{expected} either contains a value of type \tcode{T} or a value of type \tcode{E} nested within it. Member \exposid{has_val} indicates whether the \tcode{expected} object contains an object of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. The error is held as an \tcode{unexpected}, and not as an \tcode{E}, so that \tcode{E} may be an lvalue reference type: an \tcode{E\&} cannot be a union member, whereas \tcode{unexpected} holds a pointer to an external object. \rSec3[expected.object.cons]{Constructors} @@ -697,7 +697,7 @@ \pnum \effects -If \tcode{this->has_value() \&\& rhs.has_value()}, equivalent to \tcode{\exposid{val} = *rhs}. Otherwise, if \tcode{this->has_value()}, equivalent to \tcode{reinit-expected(\exposid{unex}, \exposid{val}, rhs.error())}. Otherwise, if \tcode{rhs.has_value()}, equivalent to \tcode{reinit-expected(\exposid{val}, \exposid{unex}, *rhs)}. Otherwise, equivalent to \tcode{\exposid{unex} = rhs.\exposid{unex}}. Then, if no exception was thrown, equivalent to: \tcode{has_val = rhs.has_value(); return *this;} When \tcode{E} is an lvalue reference type, each of the cases above that initializes or assigns \exposid{unex} rebinds it: \exposid{unex} comes to refer to the same object as \tcode{rhs}'s error. No previously or subsequently referenced object is assigned through. +If \tcode{this->has_value() \&\& rhs.has_value()}, equivalent to \tcode{\exposid{val} = *rhs}. Otherwise, if \tcode{this->has_value()}, equivalent to \tcode{reinit-expected(\exposid{unex}, \exposid{val}, rhs.error())}. Otherwise, if \tcode{rhs.has_value()}, equivalent to \tcode{reinit-expected(\exposid{val}, \exposid{unex}, *rhs)}. Otherwise, equivalent to \tcode{\exposid{unex} = rhs.\exposid{unex}}. Then, if no exception was thrown, equivalent to: \tcode{\exposid{has_val} = rhs.has_value(); return *this;} When \tcode{E} is an lvalue reference type, each of the cases above that initializes or assigns \exposid{unex} rebinds it: \exposid{unex} comes to refer to the same object as \tcode{rhs}'s error. No previously or subsequently referenced object is assigned through. \pnum \returns @@ -759,7 +759,7 @@ \pnum \effects -If \tcode{this->has_value() \&\& rhs.has_value()}, equivalent to \tcode{\exposid{val} = std::move(*rhs)}. Otherwise, if \tcode{this->has_value()}, equivalent to \tcode{reinit-expected(\exposid{unex}, \exposid{val}, std::move(rhs.error()))}. Otherwise, if \tcode{rhs.has_value()}, equivalent to \tcode{reinit-expected(\exposid{val}, \exposid{unex}, std::move(*rhs))}. Otherwise, equivalent to \tcode{\exposid{unex} = std::move(rhs.\exposid{unex})}. Then, if no exception was thrown, equivalent to: \tcode{has_val = rhs.has_value(); return *this;} When \tcode{E} is an lvalue reference type, each of the cases above that initializes or assigns \exposid{unex} rebinds it: \exposid{unex} comes to refer to the same object as \tcode{rhs}'s error. No previously or subsequently referenced object is assigned through. +If \tcode{this->has_value() \&\& rhs.has_value()}, equivalent to \tcode{\exposid{val} = std::move(*rhs)}. Otherwise, if \tcode{this->has_value()}, equivalent to \tcode{reinit-expected(\exposid{unex}, \exposid{val}, std::move(rhs.error()))}. Otherwise, if \tcode{rhs.has_value()}, equivalent to \tcode{reinit-expected(\exposid{val}, \exposid{unex}, std::move(*rhs))}. Otherwise, equivalent to \tcode{\exposid{unex} = std::move(rhs.\exposid{unex})}. Then, if no exception was thrown, equivalent to: \tcode{\exposid{has_val} = rhs.has_value(); return *this;} When \tcode{E} is an lvalue reference type, each of the cases above that initializes or assigns \exposid{unex} rebinds it: \exposid{unex} comes to refer to the same object as \tcode{rhs}'s error. No previously or subsequently referenced object is assigned through. \pnum \returns @@ -783,7 +783,7 @@ \pnum \effects -If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{\exposid{val} = std::forward(v);} Otherwise, equivalent to: \tcode{reinit-expected(\exposid{val}, \exposid{unex}, std::forward(v)); has_val = true;} +If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{\exposid{val} = std::forward(v);} Otherwise, equivalent to: \tcode{reinit-expected(\exposid{val}, \exposid{unex}, std::forward(v)); \exposid{has_val} = true;} \pnum \returns @@ -805,7 +805,7 @@ \pnum \effects -If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{reinit-expected(\exposid{unex}, \exposid{val}, e.error()); has_val = false;} Otherwise, equivalent to: \tcode{\exposid{unex} = unexpected(e.error());} +If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{reinit-expected(\exposid{unex}, \exposid{val}, e.error()); \exposid{has_val} = false;} Otherwise, equivalent to: \tcode{\exposid{unex} = unexpected(e.error());} \pnum \returns @@ -871,7 +871,7 @@ \pnum \effects -Equivalent to: \tcode{if (has_value()) \{ destroy_at(addressof(\exposid{val})); \} else \{ destroy_at(addressof(\exposid{unex})); has_val = true; \} return *construct_at(addressof(\exposid{val}), std::forward(args)...);} +Equivalent to: \tcode{if (has_value()) \{ destroy_at(addressof(\exposid{val})); \} else \{ destroy_at(addressof(\exposid{unex})); \exposid{has_val} = true; \} return *construct_at(addressof(\exposid{val}), std::forward(args)...);} \end{itemdescr} \indexlibrarymember{emplace}{expected}% @@ -887,7 +887,7 @@ \pnum \effects -Equivalent to: \tcode{if (has_value()) \{ destroy_at(addressof(\exposid{val})); \} else \{ destroy_at(addressof(\exposid{unex})); has_val = true; \} return *construct_at(addressof(\exposid{val}), il, std::forward(args)...);} +Equivalent to: \tcode{if (has_value()) \{ destroy_at(addressof(\exposid{val})); \} else \{ destroy_at(addressof(\exposid{unex})); \exposid{has_val} = true; \} return *construct_at(addressof(\exposid{val}), il, std::forward(args)...);} \end{itemdescr} \rSec3[expected.object.swap]{Swap} @@ -1004,7 +1004,7 @@ \begin{itemdescr} \pnum \returns -\tcode{has_val}. +\exposid{has_val}. \end{itemdescr} \indexlibrarymember{value}{expected}% diff --git a/papers/wording/fragments/expected.ref.tex b/papers/wording/fragments/expected.ref.tex index 3a712948..07615a00 100644 --- a/papers/wording/fragments/expected.ref.tex +++ b/papers/wording/fragments/expected.ref.tex @@ -176,7 +176,7 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposid{has-val}@; // \expos + bool @\exposid{has_val}@; // \expos union { T* @\exposid{val}@; // \expos unexpected @\exposid{unex}@; // \expos @@ -191,7 +191,7 @@ \pnum \remarks -An object of type \tcode{expected} either represents a reference to an object of type \tcode{T}, or holds an error. Member \tcode{has_val} indicates whether the object represents a reference. When it represents a reference, member \exposid{val} points to the referenced object, which is not owned by the \tcode{expected} object. Otherwise, the error is \tcode{\exposid{unex}.error()}. +An object of type \tcode{expected} either represents a reference to an object of type \tcode{T}, or holds an error. Member \exposid{has_val} indicates whether the object represents a reference. When it represents a reference, member \exposid{val} points to the referenced object, which is not owned by the \tcode{expected} object. Otherwise, the error is \tcode{\exposid{unex}.error()}. \rSec3[expected.ref.cons]{Constructors} @@ -623,7 +623,7 @@ \pnum \effects -Let \tcode{r} be the lvalue result of \tcode{T\& r = std::forward(u);}. If \tcode{has_value()} is \tcode{true}, assigns \tcode{addressof(r)} to \exposid{val}. Otherwise, destroys \exposid{unex}, initializes \exposid{val} with \tcode{addressof(r)}, and sets \tcode{has_val} to \tcode{true}; if binding \tcode{r} throws, \tcode{*this} is left unchanged. +Let \tcode{r} be the lvalue result of \tcode{T\& r = std::forward(u);}. If \tcode{has_value()} is \tcode{true}, assigns \tcode{addressof(r)} to \exposid{val}. Otherwise, destroys \exposid{unex}, initializes \exposid{val} with \tcode{addressof(r)}, and sets \exposid{has_val} to \tcode{true}; if binding \tcode{r} throws, \tcode{*this} is left unchanged. \pnum \returns @@ -707,7 +707,7 @@ \pnum \effects -Rebinds \tcode{*this} to refer to the object bound by \tcode{T\& r = std::forward(u);}: if \tcode{has_value()} is \tcode{false}, destroys \exposid{unex} first. Sets \exposid{val} to \tcode{addressof(r)} and \tcode{has_val} to \tcode{true}. +Rebinds \tcode{*this} to refer to the object bound by \tcode{T\& r = std::forward(u);}: if \tcode{has_value()} is \tcode{false}, destroys \exposid{unex} first. Sets \exposid{val} to \tcode{addressof(r)} and \exposid{has_val} to \tcode{true}. \pnum \returns @@ -801,7 +801,7 @@ \begin{itemdescr} \pnum \returns -\tcode{has_val}. +\exposid{has_val}. \end{itemdescr} \indexlibrarymember{value}{expected}% diff --git a/papers/wording/fragments/expected.void.tex b/papers/wording/fragments/expected.void.tex index 8a8733ab..51c17ccc 100644 --- a/papers/wording/fragments/expected.void.tex +++ b/papers/wording/fragments/expected.void.tex @@ -151,7 +151,7 @@ friend constexpr bool operator==(const expected& x, const unexpected& e); private: - bool @\exposid{has-val}@; // \expos + bool @\exposid{has_val}@; // \expos union { unexpected @\exposid{unex}@; // \expos }; @@ -165,7 +165,7 @@ \pnum \remarks -Any object of type \tcode{expected} either represents a value of type \tcode{T}, or contains a value of type \tcode{E} nested within it. Member \tcode{has_val} indicates whether the \tcode{expected} object represents a value of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. +Any object of type \tcode{expected} either represents a value of type \tcode{T}, or contains a value of type \tcode{E} nested within it. Member \exposid{has_val} indicates whether the \tcode{expected} object represents a value of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. \rSec3[expected.void.cons]{Constructors} @@ -481,7 +481,7 @@ \pnum \effects -If \tcode{this->has_value() \&\& rhs.has_value()}, no effects. Otherwise, if \tcode{this->has_value()}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), rhs.\exposid{unex}); has_val = false;} Otherwise, if \tcode{rhs.has_value()}, destroys \exposid{unex} and sets \tcode{has_val} to \tcode{true}. Otherwise, equivalent to \tcode{\exposid{unex} = rhs.\exposid{unex}}. +If \tcode{this->has_value() \&\& rhs.has_value()}, no effects. Otherwise, if \tcode{this->has_value()}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), rhs.\exposid{unex}); \exposid{has_val} = false;} Otherwise, if \tcode{rhs.has_value()}, destroys \exposid{unex} and sets \exposid{has_val} to \tcode{true}. Otherwise, equivalent to \tcode{\exposid{unex} = rhs.\exposid{unex}}. \pnum \returns @@ -505,7 +505,7 @@ \pnum \effects -If \tcode{this->has_value() \&\& rhs.has_value()}, no effects. Otherwise, if \tcode{this->has_value()}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), std::move(rhs.\exposid{unex})); has_val = false;} Otherwise, if \tcode{rhs.has_value()}, destroys \exposid{unex} and sets \tcode{has_val} to \tcode{true}. Otherwise, equivalent to \tcode{\exposid{unex} = std::move(rhs.\exposid{unex})}. +If \tcode{this->has_value() \&\& rhs.has_value()}, no effects. Otherwise, if \tcode{this->has_value()}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), std::move(rhs.\exposid{unex})); \exposid{has_val} = false;} Otherwise, if \tcode{rhs.has_value()}, destroys \exposid{unex} and sets \exposid{has_val} to \tcode{true}. Otherwise, equivalent to \tcode{\exposid{unex} = std::move(rhs.\exposid{unex})}. \pnum \returns @@ -531,7 +531,7 @@ \pnum \effects -If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), e.error()); has_val = false;} Otherwise, equivalent to: \tcode{\exposid{unex} = unexpected(e.error());} +If \tcode{has_value()} is \tcode{true}, equivalent to: \tcode{construct_at(addressof(\exposid{unex}), e.error()); \exposid{has_val} = false;} Otherwise, equivalent to: \tcode{\exposid{unex} = unexpected(e.error());} \pnum \returns @@ -592,7 +592,7 @@ \begin{itemdescr} \pnum \effects -If \tcode{has_value()} is \tcode{false}, destroys \exposid{unex} and sets \tcode{has_val} to \tcode{true}. +If \tcode{has_value()} is \tcode{false}, destroys \exposid{unex} and sets \exposid{has_val} to \tcode{true}. \end{itemdescr} \rSec3[expected.void.swap]{Swap} @@ -648,7 +648,7 @@ \begin{itemdescr} \pnum \returns -\tcode{has_val}. +\exposid{has_val}. \end{itemdescr} \indexlibrarymember{operator*}{expected}% @@ -881,7 +881,7 @@ \pnum \effects -If \tcode{has_value()} is \tcode{false}, returns \tcode{expected(unexpect, error())}. Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an \tcode{expected} object whose \tcode{has_val} member is \tcode{true} and \tcode{val} member is direct-non-list-initialized with \tcode{invoke(std::forward(f))}. Otherwise, evaluates \tcode{invoke(std::forward(f))} and then returns \tcode{expected()}. +If \tcode{has_value()} is \tcode{false}, returns \tcode{expected(unexpect, error())}. Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an \tcode{expected} object whose \exposid{has_val} member is \tcode{true} and \tcode{val} member is direct-non-list-initialized with \tcode{invoke(std::forward(f))}. Otherwise, evaluates \tcode{invoke(std::forward(f))} and then returns \tcode{expected()}. \end{itemdescr} \indexlibrarymember{transform}{expected}% @@ -903,7 +903,7 @@ \pnum \effects -If \tcode{has_value()} is \tcode{false}, returns \tcode{expected(unexpect, std::move(error()))}. Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an \tcode{expected} object whose \tcode{has_val} member is \tcode{true} and \tcode{val} member is direct-non-list-initialized with \tcode{invoke(std::forward(f))}. Otherwise, evaluates \tcode{invoke(std::forward(f))} and then returns \tcode{expected()}. +If \tcode{has_value()} is \tcode{false}, returns \tcode{expected(unexpect, std::move(error()))}. Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an \tcode{expected} object whose \exposid{has_val} member is \tcode{true} and \tcode{val} member is direct-non-list-initialized with \tcode{invoke(std::forward(f))}. Otherwise, evaluates \tcode{invoke(std::forward(f))} and then returns \tcode{expected()}. \end{itemdescr} \indexlibrarymember{transform_error}{expected}% @@ -921,7 +921,7 @@ \pnum \returns -If \tcode{has_value()} is \tcode{true}, \tcode{expected()}; otherwise, an \tcode{expected} object whose \tcode{has_val} member is \tcode{false} and \exposid{unex} member is direct-non-list-initialized with \tcode{invoke(std::forward(f), error())}. +If \tcode{has_value()} is \tcode{true}, \tcode{expected()}; otherwise, an \tcode{expected} object whose \exposid{has_val} member is \tcode{false} and \exposid{unex} member is direct-non-list-initialized with \tcode{invoke(std::forward(f), error())}. \end{itemdescr} \indexlibrarymember{transform_error}{expected}% @@ -939,7 +939,7 @@ \pnum \returns -If \tcode{has_value()} is \tcode{true}, \tcode{expected()}; otherwise, an \tcode{expected} object whose \tcode{has_val} member is \tcode{false} and \exposid{unex} member is direct-non-list-initialized with \tcode{invoke(std::forward(f), std::move(error()))}. +If \tcode{has_value()} is \tcode{true}, \tcode{expected()}; otherwise, an \tcode{expected} object whose \exposid{has_val} member is \tcode{false} and \exposid{unex} member is direct-non-list-initialized with \tcode{invoke(std::forward(f), std::move(error()))}. \end{itemdescr} \rSec3[expected.void.eq]{Equality operators} From 54989d487aa12d8ea7e172417bd105ee71f628ae Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:12:20 -0500 Subject: [PATCH 06/12] Mark the code in the section titles Seven titles name a class or a type as plain text. Written with backticks, each renders as \tcode{...} with its & escaped, and every heading of the generated wording is now the paper's. --- include/beman/expected/bad_expected_access.hpp | 4 ++-- include/beman/expected/expected.hpp | 6 +++--- include/beman/expected/unexpected.hpp | 4 ++-- papers/wording/expected.tex | 14 +++++++------- papers/wording/fragments/expected.bad.tex | 2 +- papers/wording/fragments/expected.bad.void.tex | 2 +- papers/wording/fragments/expected.expected.tex | 2 +- papers/wording/fragments/expected.ref.tex | 2 +- papers/wording/fragments/expected.unexpected.tex | 4 ++-- papers/wording/fragments/expected.void.tex | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/beman/expected/bad_expected_access.hpp b/include/beman/expected/bad_expected_access.hpp index 15af55f8..1c9220e0 100644 --- a/include/beman/expected/bad_expected_access.hpp +++ b/include/beman/expected/bad_expected_access.hpp @@ -60,7 +60,7 @@ namespace expected { template class bad_expected_access; -// \rSec2[expected.bad.void]{Class template specialization bad_expected_access} +// \rSec2[expected.bad.void]{Class template specialization `bad_expected_access`} template <> class bad_expected_access : public std::exception { protected: @@ -75,7 +75,7 @@ class bad_expected_access : public std::exception { BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* what() const noexcept override; }; -// \rSec2[expected.bad]{Class template bad_expected_access} +// \rSec2[expected.bad]{Class template `bad_expected_access`} //! \remarks The class template `bad_expected_access` defines the type of //! objects thrown as exceptions to report the situation where an attempt is //! made to access the value of an `expected` object for which diff --git a/include/beman/expected/expected.hpp b/include/beman/expected/expected.hpp index 4a8a2043..1892ba28 100644 --- a/include/beman/expected/expected.hpp +++ b/include/beman/expected/expected.hpp @@ -120,7 +120,7 @@ constexpr bool converts_from_any_cvref = std::disjunction_v>; } // namespace detail -// \rSec2[expected.expected]{Class template expected} +// \rSec2[expected.expected]{Class template `expected`} // \rSec3[expected.object.general]{General} //! \mandates A program that instantiates the definition of `expected` //! with a `T` that is not a valid value type for `expected` (that is, @@ -1838,7 +1838,7 @@ constexpr auto expected::transform_error(F&& f) const&& { // [expected.void] Partial specialization for void value type // ============================================================================= -// \rSec2[expected.void]{Partial specialization of expected for void types} +// \rSec2[expected.void]{Partial specialization of `expected` for `void` types} // \rSec3[expected.void.general]{General} //! \at expected.void.general //! \mandates A program that instantiates the definition of `expected` @@ -3112,7 +3112,7 @@ constexpr auto expected::transform_error(F&& f) const&& { // (E may be an object type or an lvalue reference to one) // ============================================================================= -// \rSec2[expected.ref]{Partial specialization of expected for reference types} +// \rSec2[expected.ref]{Partial specialization of `expected` for reference types} // \rSec3[expected.ref.general]{General} //! \at expected.ref.general //! \mandates A program that instantiates the definition of `expected unexpected; // \rSec3[expected.un.swap]{Swap} // \rSec3[expected.un.eq]{Equality operator} -// \rSec3[expected.un.ref]{Partial specialization unexpected} +// \rSec3[expected.un.ref]{Partial specialization `unexpected`} // Stores a pointer to the referenced object; keeps expected<> from needing a // separate set of specializations just to hold a reference error type. //! \at expected.un.ref diff --git a/papers/wording/expected.tex b/papers/wording/expected.tex index 4f0cfd7f..191c08f8 100644 --- a/papers/wording/expected.tex +++ b/papers/wording/expected.tex @@ -17,7 +17,7 @@ % \input directives. [expected.general] and [expected.syn] are prose, not % generated from any one declaration; see papers/expected-new.tex. -\rSec2[expected.unexpected]{Class template unexpected} +\rSec2[expected.unexpected]{Class template \tcode{unexpected}} \rSec3[expected.un.general]{General} @@ -215,7 +215,7 @@ \tcode{x.error() == y.error()}. \end{itemdescr} -\rSec3[expected.un.ref]{Partial specialization unexpected} +\rSec3[expected.un.ref]{Partial specialization \tcode{unexpected}} \begin{codeblock} namespace std { @@ -349,7 +349,7 @@ Equivalent to \tcode{x.swap(y)}. \end{itemdescr} -\rSec2[expected.bad]{Class template bad_expected_access} +\rSec2[expected.bad]{Class template \tcode{bad_expected_access}} \indexlibrarymember{what}{bad_expected_access}% \begin{itemdecl} @@ -450,7 +450,7 @@ \tcode{std::move(\exposid{unex})}. \end{itemdescr} -\rSec2[expected.bad.void]{Class template specialization bad_expected_access} +\rSec2[expected.bad.void]{Class template specialization \tcode{bad_expected_access}} \begin{codeblock} namespace std { @@ -474,7 +474,7 @@ } \end{codeblock} -\rSec2[expected.expected]{Class template expected} +\rSec2[expected.expected]{Class template \tcode{expected}} \rSec3[expected.object.general]{General} @@ -1865,7 +1865,7 @@ \tcode{!x.has_value() \&\& static_cast(x.error() == e.error())}. \end{itemdescr} -\rSec2[expected.void]{Partial specialization of expected for void types} +\rSec2[expected.void]{Partial specialization of \tcode{expected} for \tcode{void} types} \rSec3[expected.void.general]{General} @@ -2847,7 +2847,7 @@ \tcode{!x.has_value() \&\& static_cast(x.error() == e.error())}. \end{itemdescr} -\rSec2[expected.ref]{Partial specialization of expected for reference types} +\rSec2[expected.ref]{Partial specialization of \tcode{expected} for reference types} \rSec3[expected.ref.general]{General} diff --git a/papers/wording/fragments/expected.bad.tex b/papers/wording/fragments/expected.bad.tex index 8db2ed42..eac03cbd 100644 --- a/papers/wording/fragments/expected.bad.tex +++ b/papers/wording/fragments/expected.bad.tex @@ -1,4 +1,4 @@ -\rSec2[expected.bad]{Class template bad_expected_access} +\rSec2[expected.bad]{Class template \tcode{bad_expected_access}} \indexlibrarymember{what}{bad_expected_access}% \begin{itemdecl} diff --git a/papers/wording/fragments/expected.bad.void.tex b/papers/wording/fragments/expected.bad.void.tex index 7498f4e3..c06637b4 100644 --- a/papers/wording/fragments/expected.bad.void.tex +++ b/papers/wording/fragments/expected.bad.void.tex @@ -1,4 +1,4 @@ -\rSec2[expected.bad.void]{Class template specialization bad_expected_access} +\rSec2[expected.bad.void]{Class template specialization \tcode{bad_expected_access}} \begin{codeblock} namespace std { diff --git a/papers/wording/fragments/expected.expected.tex b/papers/wording/fragments/expected.expected.tex index 244489c0..e516472f 100644 --- a/papers/wording/fragments/expected.expected.tex +++ b/papers/wording/fragments/expected.expected.tex @@ -1,4 +1,4 @@ -\rSec2[expected.expected]{Class template expected} +\rSec2[expected.expected]{Class template \tcode{expected}} \rSec3[expected.object.general]{General} diff --git a/papers/wording/fragments/expected.ref.tex b/papers/wording/fragments/expected.ref.tex index 07615a00..acfd6fa7 100644 --- a/papers/wording/fragments/expected.ref.tex +++ b/papers/wording/fragments/expected.ref.tex @@ -1,4 +1,4 @@ -\rSec2[expected.ref]{Partial specialization of expected for reference types} +\rSec2[expected.ref]{Partial specialization of \tcode{expected} for reference types} \rSec3[expected.ref.general]{General} diff --git a/papers/wording/fragments/expected.unexpected.tex b/papers/wording/fragments/expected.unexpected.tex index 05d1ed0a..c8b7b83f 100644 --- a/papers/wording/fragments/expected.unexpected.tex +++ b/papers/wording/fragments/expected.unexpected.tex @@ -1,4 +1,4 @@ -\rSec2[expected.unexpected]{Class template unexpected} +\rSec2[expected.unexpected]{Class template \tcode{unexpected}} \rSec3[expected.un.general]{General} @@ -196,7 +196,7 @@ \tcode{x.error() == y.error()}. \end{itemdescr} -\rSec3[expected.un.ref]{Partial specialization unexpected} +\rSec3[expected.un.ref]{Partial specialization \tcode{unexpected}} \begin{codeblock} namespace std { diff --git a/papers/wording/fragments/expected.void.tex b/papers/wording/fragments/expected.void.tex index 51c17ccc..f45276c9 100644 --- a/papers/wording/fragments/expected.void.tex +++ b/papers/wording/fragments/expected.void.tex @@ -1,4 +1,4 @@ -\rSec2[expected.void]{Partial specialization of expected for void types} +\rSec2[expected.void]{Partial specialization of \tcode{expected} for \tcode{void} types} \rSec3[expected.void.general]{General} From f22e4650bc3b71b5122fb3d7ba7af6d56bd0e76b Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:15:09 -0500 Subject: [PATCH 07/12] Write the draft's own macros where the docblocks spelled them in words what() returned "an implementation-defined ntbs"; it is now the draft's \impldef{...} \ntbs{}, with the index text the draft has for each class. \iref prints its own parentheses and its own space, so the two around lex.ccon go, and the reference after "Subclause" is the bare \ref. Three sentences the docblocks share with the draft take the macro the draft has in them: \cv{} before bool in two Constraints, \Fundescx{Effects} in two Throws, and \iref{intro.object} after "nested within" in two class descriptions. --- .../beman/expected/bad_expected_access.hpp | 12 ++++--- include/beman/expected/expected.hpp | 33 ++++++++++--------- include/beman/expected/unexpected.hpp | 2 +- papers/wording/expected.tex | 18 +++++----- papers/wording/fragments/expected.bad.tex | 4 +-- .../wording/fragments/expected.expected.tex | 8 ++--- .../wording/fragments/expected.unexpected.tex | 2 +- papers/wording/fragments/expected.void.tex | 4 +-- 8 files changed, 44 insertions(+), 39 deletions(-) diff --git a/include/beman/expected/bad_expected_access.hpp b/include/beman/expected/bad_expected_access.hpp index 1c9220e0..469e14e8 100644 --- a/include/beman/expected/bad_expected_access.hpp +++ b/include/beman/expected/bad_expected_access.hpp @@ -97,8 +97,10 @@ class bad_expected_access : public bad_expected_access { // bad_expected_access out-of-line definitions -//! \returns An implementation-defined ntbs, which during constant evaluation -//! is encoded with the ordinary literal encoding (\iref{lex.ccon}). +//! \returns An +//! \impldef{return value of \tcode{bad_expected_access::what}} +//! \ntbs{}, which during constant evaluation is encoded with the ordinary +//! literal encoding\iref{lex.ccon}. inline BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* bad_expected_access::what() const noexcept { return "bad expected access"; } @@ -109,8 +111,10 @@ inline BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* bad_expected_access: template BEMAN_EXPECTED_CONSTEXPR_EXCEPTION bad_expected_access::bad_expected_access(E e) : unex(std::move(e)) {} -//! \returns An implementation-defined ntbs, which during constant evaluation -//! is encoded with the ordinary literal encoding (\iref{lex.ccon}). +//! \returns An +//! \impldef{return value of \tcode{bad_expected_access::what}} +//! \ntbs{}, which during constant evaluation is encoded with the ordinary +//! literal encoding\iref{lex.ccon}. template BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* bad_expected_access::what() const noexcept { return "bad expected access"; diff --git a/include/beman/expected/expected.hpp b/include/beman/expected/expected.hpp index 1892ba28..01ec5d9e 100644 --- a/include/beman/expected/expected.hpp +++ b/include/beman/expected/expected.hpp @@ -130,10 +130,10 @@ constexpr bool converts_from_any_cvref = std::disjunction_v` with an `E` that is not a valid template argument for `unexpected` //! is ill-formed. //! \remarks Any object of type `expected` either contains a value of -//! type `T` or a value of type `E` nested within it. Member `has_val` -//! indicates whether the `expected` object contains an object of type -//! `T`. When `has_value()` is `false`, the error is `unex.error()`. The -//! error is held as an `unexpected`, and not as an `E`, so that `E` may +//! type `T` or a value of type `E` nested within\iref{intro.object} it. Member +//! `has_val` indicates whether the `expected` object contains an object +//! of type `T`. When `has_value()` is `false`, the error is `unex.error()`. +//! The error is held as an `unexpected`, and not as an `E`, so that `E` may //! be an lvalue reference type: an `E&` cannot be a union member, whereas //! `unexpected` holds a pointer to an external object. template @@ -720,13 +720,12 @@ constexpr expected::expected(expected&& rhs) noexcept(std::is_nothrow_move //! \group cvt-copy-ctor //! \constraints `is_constructible_v` is `true`; and -//! `is_constructible_v` is `true`; and if `T` is not `bool`, -//! `converts-from-any-cvref>` is `false`; and +//! `is_constructible_v` is `true`; and if `T` is not \cv{} +//! `bool`, `converts-from-any-cvref>` is `false`; and //! `is_constructible_v, expected&>` is `false`; and //! `is_constructible_v, expected>` is `false`; and -//! `is_constructible_v, const expected&>` is `false`; -//! and `is_constructible_v, const expected>` is -//! `false`. +//! `is_constructible_v, const expected&>` is `false`; and +//! `is_constructible_v, const expected>` is `false`. //! \effects If `rhs.has_value()`, direct-non-list-initializes `val` with //! `*rhs`. Otherwise, direct-non-list-initializes `unex` with //! `rhs.error()`. @@ -803,7 +802,7 @@ constexpr expected::expected(expected&& rhs) : has_val_(rhs.has_valu //! `is_same_v, unexpect_t>` is `false`; and //! `is_same_v, expected>` is `false`; and //! `is_constructible_v` is `true`; and `remove_cvref_t` is not a -//! specialization of `unexpected`; and if `T` is `bool`, +//! specialization of `unexpected`; and if `T` is \cv{} `bool`, //! `remove_cvref_t` is not a specialization of `expected`. //! \effects Direct-non-list-initializes `val` with `std::forward(v)`. //! \ensures `has_value()` is `true`. @@ -1195,7 +1194,8 @@ constexpr T& expected::emplace(std::initializer_list il, Args&&... args //! unchanged), leaving `has_value()` `false` and `rhs.has_value()` `true`. //! If `rhs.has_value()` is `true` and `this->has_value()` is `false`, //! equivalent to `rhs.swap(*this)`. -//! \throws Any exception thrown by the expressions in the Effects. +//! \throws Any exception thrown by the expressions in the +//! \Fundescx{Effects}. //! \remarks The exception specification is equivalent to //! `is_nothrow_move_constructible_v && is_nothrow_swappable_v && //! is_nothrow_move_constructible_v && (is_reference_v || @@ -1844,10 +1844,10 @@ constexpr auto expected::transform_error(F&& f) const&& { //! \mandates A program that instantiates the definition of `expected` //! with an `E` that is not a valid template argument for `unexpected` is //! ill-formed. -//! \remarks Any object of type `expected` either represents a value -//! of type `T`, or contains a value of type `E` nested within it. Member -//! `has_val` indicates whether the `expected` object represents a -//! value of type `T`. When `has_value()` is `false`, the error is +//! \remarks Any object of type `expected` either represents a value of +//! type `T`, or contains a value of type `E` nested within\iref{intro.object} +//! it. Member `has_val` indicates whether the `expected` object +//! represents a value of type `T`. When `has_value()` is `false`, the error is //! `unex.error()`. template class expected { @@ -2624,7 +2624,8 @@ constexpr void expected::emplace() noexcept { //! `std::move(unex)`, destroys `unex`, and leaves `has_value()` `false` //! and `rhs.has_value()` `true`. If `rhs.has_value()` is `true` and //! `this->has_value()` is `false`, equivalent to `rhs.swap(*this)`. -//! \throws Any exception thrown by the expressions in the Effects. +//! \throws Any exception thrown by the expressions in the +//! \Fundescx{Effects}. //! \remarks The exception specification is equivalent to //! `is_nothrow_move_constructible_v && (is_reference_v || //! is_nothrow_swappable_v)`. diff --git a/include/beman/expected/unexpected.hpp b/include/beman/expected/unexpected.hpp index c72554d5..43936ae7 100644 --- a/include/beman/expected/unexpected.hpp +++ b/include/beman/expected/unexpected.hpp @@ -63,7 +63,7 @@ inline constexpr bool reference_constructs_from_temporary_v = __reference_constr //! \mandates A program that instantiates the definition of `unexpected` for //! a non-object type other than an lvalue reference type, an array type, a //! specialization of `unexpected`, or a cv-qualified type is ill-formed. -//! \remarks Subclause \iref{expected.unexpected} describes the class +//! \remarks Subclause \ref{expected.unexpected} describes the class //! template `unexpected` that represents unexpected objects stored in //! `expected` objects. template diff --git a/papers/wording/expected.tex b/papers/wording/expected.tex index 191c08f8..abcaf435 100644 --- a/papers/wording/expected.tex +++ b/papers/wording/expected.tex @@ -70,7 +70,7 @@ \pnum \remarks -Subclause \iref{expected.unexpected} describes the class template \tcode{unexpected} that represents unexpected objects stored in \tcode{expected} objects. +Subclause \ref{expected.unexpected} describes the class template \tcode{unexpected} that represents unexpected objects stored in \tcode{expected} objects. \rSec3[expected.un.cons]{Constructors} @@ -359,7 +359,7 @@ \begin{itemdescr} \pnum \returns -An implementation-defined ntbs, which during constant evaluation is encoded with the ordinary literal encoding (\iref{lex.ccon}). +An \impldef{return value of \tcode{bad_expected_access::what}} \ntbs{}, which during constant evaluation is encoded with the ordinary literal encoding\iref{lex.ccon}. \end{itemdescr} \begin{codeblock} @@ -403,7 +403,7 @@ \begin{itemdescr} \pnum \returns -An implementation-defined ntbs, which during constant evaluation is encoded with the ordinary literal encoding (\iref{lex.ccon}). +An \impldef{return value of \tcode{bad_expected_access::what}} \ntbs{}, which during constant evaluation is encoded with the ordinary literal encoding\iref{lex.ccon}. \end{itemdescr} \indexlibrarymember{error}{bad_expected_access}% @@ -683,7 +683,7 @@ \pnum \remarks -Any object of type \tcode{expected} either contains a value of type \tcode{T} or a value of type \tcode{E} nested within it. Member \exposid{has_val} indicates whether the \tcode{expected} object contains an object of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. The error is held as an \tcode{unexpected}, and not as an \tcode{E}, so that \tcode{E} may be an lvalue reference type: an \tcode{E\&} cannot be a union member, whereas \tcode{unexpected} holds a pointer to an external object. +Any object of type \tcode{expected} either contains a value of type \tcode{T} or a value of type \tcode{E} nested within\iref{intro.object} it. Member \exposid{has_val} indicates whether the \tcode{expected} object contains an object of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. The error is held as an \tcode{unexpected}, and not as an \tcode{E}, so that \tcode{E} may be an lvalue reference type: an \tcode{E\&} cannot be a union member, whereas \tcode{unexpected} holds a pointer to an external object. \rSec3[expected.object.cons]{Constructors} @@ -815,7 +815,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{is_constructible_v} is \tcode{true}; and \tcode{is_constructible_v} is \tcode{true}; and if \tcode{T} is not \tcode{bool}, \tcode{converts-from-any-cvref>} is \tcode{false}; and \tcode{is_constructible_v, expected\&>} is \tcode{false}; and \tcode{is_constructible_v, expected>} is \tcode{false}; and \tcode{is_constructible_v, const expected\&>} is \tcode{false}; and \tcode{is_constructible_v, const expected>} is \tcode{false}. +\tcode{is_constructible_v} is \tcode{true}; and \tcode{is_constructible_v} is \tcode{true}; and if \tcode{T} is not \cv{} \tcode{bool}, \tcode{converts-from-any-cvref>} is \tcode{false}; and \tcode{is_constructible_v, expected\&>} is \tcode{false}; and \tcode{is_constructible_v, expected>} is \tcode{false}; and \tcode{is_constructible_v, const expected\&>} is \tcode{false}; and \tcode{is_constructible_v, const expected>} is \tcode{false}. \pnum \effects @@ -869,7 +869,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{is_same_v, in_place_t>} is \tcode{false}; and \tcode{is_same_v, unexpect_t>} is \tcode{false}; and \tcode{is_same_v, expected>} is \tcode{false}; and \tcode{is_constructible_v} is \tcode{true}; and \tcode{remove_cvref_t} is not a specialization of \tcode{unexpected}; and if \tcode{T} is \tcode{bool}, \tcode{remove_cvref_t} is not a specialization of \tcode{expected}. +\tcode{is_same_v, in_place_t>} is \tcode{false}; and \tcode{is_same_v, unexpect_t>} is \tcode{false}; and \tcode{is_same_v, expected>} is \tcode{false}; and \tcode{is_constructible_v} is \tcode{true}; and \tcode{remove_cvref_t} is not a specialization of \tcode{unexpected}; and if \tcode{T} is \cv{} \tcode{bool}, \tcode{remove_cvref_t} is not a specialization of \tcode{expected}. \pnum \effects @@ -1392,7 +1392,7 @@ \pnum \throws -Any exception thrown by the expressions in the Effects. +Any exception thrown by the expressions in the \Fundescx{Effects}. \pnum \remarks @@ -2032,7 +2032,7 @@ \pnum \remarks -Any object of type \tcode{expected} either represents a value of type \tcode{T}, or contains a value of type \tcode{E} nested within it. Member \exposid{has_val} indicates whether the \tcode{expected} object represents a value of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. +Any object of type \tcode{expected} either represents a value of type \tcode{T}, or contains a value of type \tcode{E} nested within\iref{intro.object} it. Member \exposid{has_val} indicates whether the \tcode{expected} object represents a value of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. \rSec3[expected.void.cons]{Constructors} @@ -2481,7 +2481,7 @@ \pnum \throws -Any exception thrown by the expressions in the Effects. +Any exception thrown by the expressions in the \Fundescx{Effects}. \pnum \remarks diff --git a/papers/wording/fragments/expected.bad.tex b/papers/wording/fragments/expected.bad.tex index eac03cbd..beca9dcd 100644 --- a/papers/wording/fragments/expected.bad.tex +++ b/papers/wording/fragments/expected.bad.tex @@ -8,7 +8,7 @@ \begin{itemdescr} \pnum \returns -An implementation-defined ntbs, which during constant evaluation is encoded with the ordinary literal encoding (\iref{lex.ccon}). +An \impldef{return value of \tcode{bad_expected_access::what}} \ntbs{}, which during constant evaluation is encoded with the ordinary literal encoding\iref{lex.ccon}. \end{itemdescr} \begin{codeblock} @@ -52,7 +52,7 @@ \begin{itemdescr} \pnum \returns -An implementation-defined ntbs, which during constant evaluation is encoded with the ordinary literal encoding (\iref{lex.ccon}). +An \impldef{return value of \tcode{bad_expected_access::what}} \ntbs{}, which during constant evaluation is encoded with the ordinary literal encoding\iref{lex.ccon}. \end{itemdescr} \indexlibrarymember{error}{bad_expected_access}% diff --git a/papers/wording/fragments/expected.expected.tex b/papers/wording/fragments/expected.expected.tex index e516472f..d76f6114 100644 --- a/papers/wording/fragments/expected.expected.tex +++ b/papers/wording/fragments/expected.expected.tex @@ -207,7 +207,7 @@ \pnum \remarks -Any object of type \tcode{expected} either contains a value of type \tcode{T} or a value of type \tcode{E} nested within it. Member \exposid{has_val} indicates whether the \tcode{expected} object contains an object of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. The error is held as an \tcode{unexpected}, and not as an \tcode{E}, so that \tcode{E} may be an lvalue reference type: an \tcode{E\&} cannot be a union member, whereas \tcode{unexpected} holds a pointer to an external object. +Any object of type \tcode{expected} either contains a value of type \tcode{T} or a value of type \tcode{E} nested within\iref{intro.object} it. Member \exposid{has_val} indicates whether the \tcode{expected} object contains an object of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. The error is held as an \tcode{unexpected}, and not as an \tcode{E}, so that \tcode{E} may be an lvalue reference type: an \tcode{E\&} cannot be a union member, whereas \tcode{unexpected} holds a pointer to an external object. \rSec3[expected.object.cons]{Constructors} @@ -339,7 +339,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{is_constructible_v} is \tcode{true}; and \tcode{is_constructible_v} is \tcode{true}; and if \tcode{T} is not \tcode{bool}, \tcode{converts-from-any-cvref>} is \tcode{false}; and \tcode{is_constructible_v, expected\&>} is \tcode{false}; and \tcode{is_constructible_v, expected>} is \tcode{false}; and \tcode{is_constructible_v, const expected\&>} is \tcode{false}; and \tcode{is_constructible_v, const expected>} is \tcode{false}. +\tcode{is_constructible_v} is \tcode{true}; and \tcode{is_constructible_v} is \tcode{true}; and if \tcode{T} is not \cv{} \tcode{bool}, \tcode{converts-from-any-cvref>} is \tcode{false}; and \tcode{is_constructible_v, expected\&>} is \tcode{false}; and \tcode{is_constructible_v, expected>} is \tcode{false}; and \tcode{is_constructible_v, const expected\&>} is \tcode{false}; and \tcode{is_constructible_v, const expected>} is \tcode{false}. \pnum \effects @@ -393,7 +393,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{is_same_v, in_place_t>} is \tcode{false}; and \tcode{is_same_v, unexpect_t>} is \tcode{false}; and \tcode{is_same_v, expected>} is \tcode{false}; and \tcode{is_constructible_v} is \tcode{true}; and \tcode{remove_cvref_t} is not a specialization of \tcode{unexpected}; and if \tcode{T} is \tcode{bool}, \tcode{remove_cvref_t} is not a specialization of \tcode{expected}. +\tcode{is_same_v, in_place_t>} is \tcode{false}; and \tcode{is_same_v, unexpect_t>} is \tcode{false}; and \tcode{is_same_v, expected>} is \tcode{false}; and \tcode{is_constructible_v} is \tcode{true}; and \tcode{remove_cvref_t} is not a specialization of \tcode{unexpected}; and if \tcode{T} is \cv{} \tcode{bool}, \tcode{remove_cvref_t} is not a specialization of \tcode{expected}. \pnum \effects @@ -916,7 +916,7 @@ \pnum \throws -Any exception thrown by the expressions in the Effects. +Any exception thrown by the expressions in the \Fundescx{Effects}. \pnum \remarks diff --git a/papers/wording/fragments/expected.unexpected.tex b/papers/wording/fragments/expected.unexpected.tex index c8b7b83f..941e92be 100644 --- a/papers/wording/fragments/expected.unexpected.tex +++ b/papers/wording/fragments/expected.unexpected.tex @@ -51,7 +51,7 @@ \pnum \remarks -Subclause \iref{expected.unexpected} describes the class template \tcode{unexpected} that represents unexpected objects stored in \tcode{expected} objects. +Subclause \ref{expected.unexpected} describes the class template \tcode{unexpected} that represents unexpected objects stored in \tcode{expected} objects. \rSec3[expected.un.cons]{Constructors} diff --git a/papers/wording/fragments/expected.void.tex b/papers/wording/fragments/expected.void.tex index f45276c9..93f78ea9 100644 --- a/papers/wording/fragments/expected.void.tex +++ b/papers/wording/fragments/expected.void.tex @@ -165,7 +165,7 @@ \pnum \remarks -Any object of type \tcode{expected} either represents a value of type \tcode{T}, or contains a value of type \tcode{E} nested within it. Member \exposid{has_val} indicates whether the \tcode{expected} object represents a value of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. +Any object of type \tcode{expected} either represents a value of type \tcode{T}, or contains a value of type \tcode{E} nested within\iref{intro.object} it. Member \exposid{has_val} indicates whether the \tcode{expected} object represents a value of type \tcode{T}. When \tcode{has_value()} is \tcode{false}, the error is \tcode{\exposid{unex}.error()}. \rSec3[expected.void.cons]{Constructors} @@ -614,7 +614,7 @@ \pnum \throws -Any exception thrown by the expressions in the Effects. +Any exception thrown by the expressions in the \Fundescx{Effects}. \pnum \remarks From 23188c3c70743b2862a85c1a970e7a7fe0f64649 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:17:46 -0500 Subject: [PATCH 08/12] Add a wording-gap goal that measures the generated wording It prints two things and fails on neither. One is the token difference between the generated wording and the paper's hand-written wording with its markup stripped, for code and for prose. The other is the change marks per clause in specgen's diff against the working draft, beside the marks the paper makes by hand; it needs DRAFT_SOURCE to name a draft checkout. Both were counted by hand until now, with scripts that were not kept. --- Makefile | 41 +++++++++++ papers/wording-gap.py | 151 +++++++++++++++++++++++++++++++++++++++ papers/wording/README.md | 18 +++++ 3 files changed, 210 insertions(+) create mode 100755 papers/wording-gap.py diff --git a/Makefile b/Makefile index e8ca24a1..15dfb5e6 100755 --- a/Makefile +++ b/Makefile @@ -262,6 +262,47 @@ wording-check: ## Check the checked-in wording matches what the headers generate diff $(WORDING_DIR)/fragments/$$fragment $(BUILD_DIR)/wording-check/fragments/$$fragment || exit 1; \ done +# Two measures of how far the generated wording is from where it is going. +# Neither fails the build; they are for judging a change to the docblocks. +# +# The first counts tokens against the paper's hand-written wording, with its +# change markup stripped. The second counts the change marks specgen makes +# when it diffs the generated wording against the working draft, beside the +# marks the paper makes by hand. It needs the draft: DRAFT_SOURCE names the +# `source` directory of a cplusplus/draft checkout, and is skipped when unset. +# specgen reads whatever revision that directory holds and records none, so +# say which it was when quoting the numbers. +# +# The draft diff is run without --validate. Reading the draft raises warnings +# no header can clear, and they must not stop a measurement. +DRAFT_SOURCE ?= +WORDING_GAP_DIR := $(BUILD_DIR)/wording-gap + +.PHONY: wording-gap +wording-gap: $(WORDING_DIR)/expected.tex ## Print how far the generated wording is from the paper's and from the working draft's (DRAFT_SOURCE=/source) + @rm -rf $(WORDING_GAP_DIR) + @mkdir -p $(WORDING_GAP_DIR)/fragments + @sed -n '/\\rSec2\[expected\.unexpected\]/,$$p' papers/expected-new.tex \ + | python3 papers/strip-wording.py > $(WORDING_GAP_DIR)/paper.tex + @python3 papers/wording-gap.py tokens \ + $(WORDING_GAP_DIR)/paper.tex $(WORDING_DIR)/expected.tex +ifeq ($(DRAFT_SOURCE),) + @echo "Change marks against the working draft: skipped, DRAFT_SOURCE is not set" +else + @$(SPECGEN) generate $(WORDING_HEADERS) \ + --backend latex --base-section-depth 2 \ + --baseline-draft $(DRAFT_SOURCE) --diff-context all \ + --split $(WORDING_GAP_DIR)/fragments \ + --root expected.unexpected.root \ + --root expected.bad.root \ + --root expected.root \ + --no-compile-commands -- $(SPECGEN_CLANG_ARGS) \ + > /dev/null 2> $(WORDING_GAP_DIR)/specgen.log \ + || echo "specgen exited $$?; see $(WORDING_GAP_DIR)/specgen.log" + @python3 papers/wording-gap.py marks papers/expected-new.tex \ + $(WORDING_GAP_DIR)/fragments $(WORDING_CLAUSES) +endif + # Deletes everything specgen and the assembly wrote, so that the next `make # wording` writes all of it again. This is for a change in specgen itself: the # rules above compare the wording with the headers, a new specgen changes the diff --git a/papers/wording-gap.py b/papers/wording-gap.py new file mode 100755 index 00000000..78b8180b --- /dev/null +++ b/papers/wording-gap.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +"""Measure how far the generated [expected] wording is from two references. + + wording-gap.py tokens PAPER GENERATED + PAPER is the paper's hand-marked wording with its change markup + stripped (strip-wording.py), GENERATED is wording/expected.tex. + Both are read from \\rSec2[expected.unexpected] to the end and + split into code -- the lines of a codeblock or an itemdecl, with + the \\begin and \\end lines -- and prose, which is everything else. + Each is counted in whitespace-separated tokens, because the paper + wraps its prose by hand and specgen writes a paragraph on one line. + "Only in" is what a minimal diff of the two token sequences leaves + on that side. + + wording-gap.py marks PAPER_MARKED DIFF_DIR CLAUSE... + PAPER_MARKED is the paper's wording as it is written, with its + \\added and addedblock markup. DIFF_DIR holds one CLAUSE.tex per + clause, the fragments of a specgen run with --baseline-draft. For + each clause, counts the change marks specgen made against the + working draft and the ones the paper makes by hand. + +Neither command fails on what it finds: these are yardsticks, not gates. +""" + +import argparse +import re +import subprocess +import sys +import tempfile +from pathlib import Path + +FIRST_CLAUSE = '\\rSec2[expected.unexpected]' +CODE_BEGIN = re.compile(r'\\begin\{(codeblock|itemdecl)\}') +CODE_END = re.compile(r'\\end\{(codeblock|itemdecl)\}') + + +def tokens(path): + """Return (code, prose) token lists for the wording in path.""" + code, prose = [], [] + in_code = False + started = False + for line in Path(path).read_text().splitlines(): + if not started: + if not line.startswith(FIRST_CLAUSE): + continue + started = True + if CODE_BEGIN.match(line): + in_code = True + code.extend(line.split()) + elif CODE_END.match(line): + in_code = False + code.extend(line.split()) + else: + (code if in_code else prose).extend(line.split()) + return code, prose + + +def only_in(left, right): + """Tokens a minimal diff leaves on each side: (only_left, only_right).""" + with tempfile.TemporaryDirectory() as tmp: + a, b = Path(tmp, 'a'), Path(tmp, 'b') + a.write_text('\n'.join(left) + '\n') + b.write_text('\n'.join(right) + '\n') + # diff exits 1 when the files differ, which is the expected case. + out = subprocess.run(['diff', '--minimal', a, b], + capture_output=True, text=True).stdout + lines = out.splitlines() + return (sum(1 for line in lines if line.startswith('<')), + sum(1 for line in lines if line.startswith('>'))) + + +def cmd_tokens(args): + paper_code, paper_prose = tokens(args.paper) + gen_code, gen_prose = tokens(args.generated) + print('Tokens, generated wording against the paper\'s:') + print(f' {"":8}{"paper":>8}{"generated":>11}' + f'{"only paper":>12}{"only generated":>16}') + for name, paper, gen in (('code', paper_code, gen_code), + ('prose', paper_prose, gen_prose)): + only_paper, only_gen = only_in(paper, gen) + print(f' {name:8}{len(paper):>8}{len(gen):>11}' + f'{only_paper:>12}{only_gen:>16}') + + +def clause_text(marked, clause): + """The text of one \\rSec2 clause of the paper's marked wording.""" + lines = Path(marked).read_text().splitlines() + out = [] + inside = False + for i, line in enumerate(lines): + if line.startswith('\\rSec2['): + inside = line.startswith(f'\\rSec2[{clause}]') + # A clause that is new as a whole is wrapped in a block that + # opens on the lines before its heading. That block is this + # clause's, not the one before's. + opening = [] + j = i - 1 + while j >= 0 and lines[j].strip() in ('', '\\begin{addedblock}'): + opening.append(lines[j]) + j -= 1 + if inside: + out.extend(reversed(opening)) + else: + del out[len(out) - min(len(out), len(opening)):] + if inside: + out.append(line) + return '\n'.join(out) + + +def count_marks(text): + return (text.count('\\added{'), text.count('\\removed{'), + text.count('\\begin{addedblock}'), + text.count('\\begin{removedblock}')) + + +def cmd_marks(args): + print('Change marks against the working draft ' + '(inline added / removed, blocks added / removed):') + print(f' {"clause":24}{"generated":>22}{"paper":>22}') + for clause in args.clauses: + fragment = Path(args.diff_dir, clause + '.tex') + if fragment.exists(): + a, r, ab, rb = count_marks(fragment.read_text()) + generated = f'{a} / {r}, {ab} / {rb}' + else: + generated = 'not written' + a, r, ab, rb = count_marks(clause_text(args.paper_marked, clause)) + paper = f'{a} / {r}, {ab} / {rb}' + print(f' {clause:24}{generated:>22}{paper:>22}') + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.split('\n')[0]) + sub = parser.add_subparsers(dest='command', required=True) + p = sub.add_parser('tokens') + p.add_argument('paper') + p.add_argument('generated') + p.set_defaults(func=cmd_tokens) + p = sub.add_parser('marks') + p.add_argument('paper_marked') + p.add_argument('diff_dir') + p.add_argument('clauses', nargs='+') + p.set_defaults(func=cmd_marks) + args = parser.parse_args() + args.func(args) + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/papers/wording/README.md b/papers/wording/README.md index 21b7791a..b069261c 100644 --- a/papers/wording/README.md +++ b/papers/wording/README.md @@ -45,6 +45,24 @@ hand-maintained prerequisite list would forget. If embedded Clang cannot locate the C++ standard library, set `SPECGEN_GCC_TOOLCHAIN` to the GCC installation prefix before regenerating. +## How far it is from the paper and from the draft + +```sh +make wording-gap DRAFT_SOURCE=/path/to/draft/source +``` + +prints two measures and fails on neither. The first is the generated wording +against the paper's hand-written `expected-new.tex`, counted in tokens of code +and of prose, with what a minimal diff leaves on each side. The second is the +change marks specgen makes when it diffs the generated wording against the +working draft, clause by clause, beside the marks the paper makes by hand. A +clause the paper does not change should have none. + +`DRAFT_SOURCE` is the `source` directory of a +[cplusplus/draft](https://github.com/cplusplus/draft) checkout; without it the +second measure is skipped. specgen reads whatever revision is there and records +none, so name the revision when quoting the numbers. + ## `expected.tex` All the generated subclauses concatenated in real standard order — From f7a05d9fe8b9ac12878859962dea4e903373dea7 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:18:27 -0500 Subject: [PATCH 09/12] Record stages 1 to 6 of the specgen catch-up, and the two specgen issues --- docs/plan/specgen-catchup.md | 95 ++++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 10 deletions(-) diff --git a/docs/plan/specgen-catchup.md b/docs/plan/specgen-catchup.md index 2a7473b7..a18d4000 100644 --- a/docs/plan/specgen-catchup.md +++ b/docs/plan/specgen-catchup.md @@ -13,6 +13,10 @@ which are the headers on `main`, and the working draft at `65890fab` **Earlier rounds:** 0.23.0, then 0.41.1 (`9d1689d`) on 2026-11-16, then 0.42.3 and 0.43.0 on 2026-11-17 and 18. Where a number moved, the earlier one is given beside it. +**Progress:** stages 1 to 6 are done, 2026-11-19, as seven commits on this +branch on top of #117's head. Each stage below says what it did. Next is +[member-routing](#member-routing); [macro-specifiers](#macro-specifiers) +waits on specgen. --- @@ -373,6 +377,17 @@ definition's, and delete the in-class copy. Check: no `error:` line from `generate`, exit status 0, and the `[expected.ref]` fragment changes only where a difference was settled. +Done (`5865daf`, `2bd9439`). Five of the seven pairs said the same thing. +Deleting all seven left the render byte for byte as it was, and the run +exits 0. The other two were the move constructor and the move assignment +operator. Each is the second declaration of a grouped item whose description +is the copy member's, so its exception specification and the condition under +which it is deleted were stated only in the docblock that was never read. +The grouped *Remarks* now state both members' conditions. The paper's +*Remarks* for the constructors says the same in fewer words ("unless that +constructor of `E` is available"), and its assignment item has no *Remarks* +at all; both are [converge-with-paper](#converge-with-paper)'s to settle. + ### Stage 2 — [regenerate](#regenerate) Regenerate the checked-in wording with the current specgen, with no header @@ -386,6 +401,9 @@ stage recurs whenever specgen changes its render; see [specgen-pin](#specgen-pin). #117 can merge as it is, with this stage's commit following it, or take this commit as a fourth. +Done for 0.47.0 (`c9d9569`), with `--warnings-as-errors` in the specgen call +and a paragraph in `papers/wording/README.md` on what fails the run. + ### Stage 3 — [gap-yardstick](#gap-yardstick) Add a goal that prints both measures: the token difference from the stripped @@ -395,18 +413,43 @@ draft. It does not fail the build. It needs a draft checkout does to these numbers. The counts in this plan were made by hand each round, and the scripts were not kept, which is the reason for the goal. +Done (`2a0102d`): `make wording-gap DRAFT_SOURCE=/source`, counted by +`papers/wording-gap.py`. On the 0.41.1 wording it gives the numbers of the +token table above, and for the paper's marks the last column of the draft +table. After stage 6, against the draft at `65890fab`: + +| | paper | generated | only in the paper | only in the generated | +|---|---|---|---|---| +| code | 3290 | 4046 | 828 | 1584 | +| prose | 5565 | 7301 | 1711 | 3447 | + +| clause | generated: inline added / removed, blocks added / removed | +|---|---| +| `[expected.unexpected]` | 15 / 8, 2 / 2 | +| `[expected.bad]` | 6 / 10, 5 / 2 | +| `[expected.bad.void]` | 12 / 7, 0 / 1 | +| `[expected.expected]` | 155 / 106, 46 / 68 | +| `[expected.void]` | 115 / 75, 33 / 44 | + ### Stage 4 — [exposition-names](#exposition-names) `\expos(has_val)` on the three `has_val_` members. Check: `\exposid{has_val}` goes from 0 to 27 and `\tcode{has_val}` to 0. Move the two `\omit` rationales back above their members. +Done (`03f0c92`). 27, and 0. The note on the deleted copy assignment is +above the primary template's `\omit`ted overload, and the note on `void_` is +above that member in the union. Neither changed the wording. + ### Stage 5 — [section-titles](#section-titles) Write the 7 titles that name code with backticks, as prose does: ``{Partial specialization `unexpected`}``. Check: each renders with `\tcode{...}` and matches the paper's title. +Done (`7d5214b`). Every heading of the generated wording, title and stable +name, is now the same as the paper's. + ### Stage 6 — [draft-prose-macros](#draft-prose-macros) Write the draft's own macros where the docblocks now spell their meaning in @@ -421,8 +464,26 @@ words or get them slightly wrong: - any `\term`, `\defn` or named requirement the draft uses in text the docblocks retype, found by reading the draft diff for the marks they leave. -Check: the marks in `[expected.bad]` and `[expected.bad.void]` fall as in the -scratch column above, and no paragraph of the plain render changes its words. +Check: the sentences changed read as the draft's do, and no other paragraph +of the plain render changes. + +Done (`8516f2c`). `what()` twice; `\iref{lex.ccon}` twice, written +`encoding\iref{lex.ccon}` with no space before it, as the draft does, since +the macro prints its own; `\ref` after "Subclause"; and three sentences the +docblocks share with the draft: `\cv{}` before `bool` in two *Constraints*, +`\Fundescx{Effects}` in two *Throws*, `\iref{intro.object}` after "nested +within" in two class descriptions. The draft's `\term{valid value type for +\tcode{expected}}` and its `\oldconcept{Destructible}` requirements are in +paragraphs the docblocks do not have in that form, and go with +[class-prose](#class-prose). + +The check first written here was wrong. It expected the marks in +`[expected.bad]` and `[expected.bad.void]` to fall as in the scratch column, +but that fall came from the macro define, which is +[macro-specifiers](#macro-specifiers). The two `what()` items still show as +one block removed and one added, because the item does not pair with the +draft's while it lacks `constexpr` and sits in another place. Their text is +now the draft's, so they will pair clean when those two are settled. ### Stage 7 — [macro-specifiers](#macro-specifiers) @@ -430,8 +491,9 @@ Have the wording show `constexpr` where the header writes `BEMAN_EXPECTED_CONSTEXPR_EXCEPTION`. Two parts. The run names the expansion the wording wants ([macro-expansion-args](#macro-expansion-args)). And the macro has to be defined where specgen reads it, which the trailing `#undef` -prevents: that is a request to specgen, listed below, and the stage waits -for it. Check: the macro appears 0 times in the wording, and +prevents: that is +[specgen#377](https://github.com/steve-downey/specgen/issues/377), and the +stage waits for it. Check: the macro appears 0 times in the wording, and `[expected.bad.void]` is left with the `= default` marks alone. ### Stage 8 — [member-routing](#member-routing) @@ -664,6 +726,9 @@ header change can clear. - 2026-11-19: specgen 0.44.0 exits 1 on a docblock error (specgen#350), so the run fails today, flag or no flag. On the scratch headers `--validate --warnings-as-errors` exits 0. +- 2026-11-19: the flag is in the makefile's specgen call (`c9d9569`), as + recommended, and off the draft diff in `wording-gap`. Applied in carrying + out [regenerate](#regenerate); not ruled on. ### header-synopsis-form @@ -819,6 +884,9 @@ holds, and lists the files in the depfile. `git archive` of that revision into a scratch directory, since the local checkout sits at N5054. `utilities.tex` does not differ between `3e3793aa` and `65890fab`. +- 2026-11-19: `DRAFT_SOURCE` is the variable (`2a0102d`), read only by + `wording-gap`, which skips the draft measure when it is unset. Where the + revision is recorded is still open. ### diff-baseline @@ -872,6 +940,11 @@ internal error after listing what it cannot place, so nothing is written. and no file. Most of the 23 are [overload-partitions](#overload-partitions) and [synopsis-shape](#synopsis-shape) seen from the draft's side. +- 2026-11-19: filed as specgen#378. The offset is directly before `public:` + in the synopsis of `expected`, where the header adds a private + exposition-only alias. A small case of the same shape does not abort, but + writes the added tokens on the draft's line, so that `public:` ends up + inside the `// \expos` comment. ### api-site-markup @@ -944,13 +1017,15 @@ rerun on these headers with 0.47.0: | [specgen#354](https://github.com/steve-downey/specgen/issues/354) | In a `--baseline-draft` diff, `\libglobal{name}` on a class head reads as a change | 0.44.2 | no mark on the class heads | | [specgen#355](https://github.com/steve-downey/specgen/issues/355) | The importer keeps `\impldef`, `\ntbs`, `\term`, `\Fundescx`, `floattable`, and a list item holding a code block as raw LaTeX | 0.46.0, in part | 4 warnings left, carried by [specgen#367](https://github.com/steve-downey/specgen/issues/367), open | -Found 2026-11-19, not filed yet: +Found 2026-11-19, and filed the same day: -| What | For | -|---|---| -| A specifier macro that the header `#undef`s after its last use is printed under its own name, where the same macro left defined is written as its expansion. The expansion wanted is the one in effect where the macro is used. Reproduction below. | [macro-specifiers](#macro-specifiers) | -| `--apply-to-draft` ends with `an edit of bytes N to N overlaps another or runs past the end` and writes no file, after reporting the changes it cannot place. This belongs on [specgen#346](https://github.com/steve-downey/specgen/issues/346), which is open for placing an added subclause. | [draft-pull-request](#draft-pull-request) | -| A set of Doxygen `ALIASES` for specgen's markers, once [api-site-markup](#api-site-markup) has one that works. | [api-site](#api-site) | +| Issue | What | For | +|---|---|---| +| [specgen#377](https://github.com/steve-downey/specgen/issues/377) | A specifier macro that the header `#undef`s after its last use is printed under its own name, where the same macro left defined is written as its expansion. The expansion wanted is the one in effect where the macro is used. Reproduction below. | [macro-specifiers](#macro-specifiers) | +| [specgen#378](https://github.com/steve-downey/specgen/issues/378) | `--apply-to-draft` writes tokens added ahead of an access specifier on that specifier's line, so a `// \expos` comment among them swallows it; and on `expected.hpp` the run ends with `an edit of bytes N to N overlaps another or runs past the end` and writes no file. Related to [specgen#346](https://github.com/steve-downey/specgen/issues/346), open for placing an added subclause. | [draft-pull-request](#draft-pull-request) | + +Not filed: a set of Doxygen `ALIASES` for specgen's markers, until +[api-site-markup](#api-site-markup) has one that works here. The reproduction for the first. With `-DUSE_CX` the synopsis reads `DEMO_CX const char* what() const noexcept;`. Without the `#undef` line it From 081b893d4b32f3f3e532bfadf5e4302e2a4bc6aa Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:21:39 -0500 Subject: [PATCH 10/12] Route members by the draft's group comments in place of \at on each A synopsis in the draft groups its members under comments of the form `// \ref{expected.object.cons}, constructors`, and specgen routes the documented in-class members after one to the section it names. The three large classes had a banner comment at each of those places, which the synopsis dropped, and an \at on every member to do the routing. The banners are now the group comments, in the paper's spelling, and the 56 \at markers they imply are gone. The synopses gain the paper's 22 group headers, and no item moves. unexpected has the one group comment the draft gives it, for its constructors; its other members sit outside it and keep their \at. The definition of bad_expected_access::what() moves up to follow its class, ahead of the section comment for the primary template, so its item is in [expected.bad.void] as the draft has it and no longer leads [expected.bad]. \at cannot route an out-of-line definition. --- .../beman/expected/bad_expected_access.hpp | 20 +-- include/beman/expected/expected.hpp | 137 +++--------------- include/beman/expected/unexpected.hpp | 4 +- papers/wording/expected.tex | 65 +++++++-- papers/wording/fragments/expected.bad.tex | 11 -- .../wording/fragments/expected.bad.void.tex | 11 ++ .../wording/fragments/expected.expected.tex | 14 ++ papers/wording/fragments/expected.ref.tex | 14 ++ .../wording/fragments/expected.unexpected.tex | 1 + papers/wording/fragments/expected.void.tex | 14 ++ 10 files changed, 140 insertions(+), 151 deletions(-) diff --git a/include/beman/expected/bad_expected_access.hpp b/include/beman/expected/bad_expected_access.hpp index 469e14e8..1da41e5b 100644 --- a/include/beman/expected/bad_expected_access.hpp +++ b/include/beman/expected/bad_expected_access.hpp @@ -75,6 +75,16 @@ class bad_expected_access : public std::exception { BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* what() const noexcept override; }; +// bad_expected_access out-of-line definitions + +//! \returns An +//! \impldef{return value of \tcode{bad_expected_access::what}} +//! \ntbs{}, which during constant evaluation is encoded with the ordinary +//! literal encoding\iref{lex.ccon}. +inline BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* bad_expected_access::what() const noexcept { + return "bad expected access"; +} + // \rSec2[expected.bad]{Class template `bad_expected_access`} //! \remarks The class template `bad_expected_access` defines the type of //! objects thrown as exceptions to report the situation where an attempt is @@ -95,16 +105,6 @@ class bad_expected_access : public bad_expected_access { E unex; }; -// bad_expected_access out-of-line definitions - -//! \returns An -//! \impldef{return value of \tcode{bad_expected_access::what}} -//! \ntbs{}, which during constant evaluation is encoded with the ordinary -//! literal encoding\iref{lex.ccon}. -inline BEMAN_EXPECTED_CONSTEXPR_EXCEPTION const char* bad_expected_access::what() const noexcept { - return "bad expected access"; -} - // bad_expected_access out-of-line definitions //! \effects Initializes `unex` with `std::move(e)`. diff --git a/include/beman/expected/expected.hpp b/include/beman/expected/expected.hpp index 01ec5d9e..d103cb4f 100644 --- a/include/beman/expected/expected.hpp +++ b/include/beman/expected/expected.hpp @@ -160,9 +160,7 @@ class expected { template using rebind = expected; - // ------------------------------------------------------------------------- - // [expected.object.cons] Constructors - // ------------------------------------------------------------------------- + // \ref{expected.object.cons}, constructors // Default constructor: value-initializes T constexpr expected() noexcept(std::is_nothrow_default_constructible_v) @@ -173,7 +171,6 @@ class expected { // then implicitly defined as deleted), and the more-constrained // non-trivial-path overload below is selected over it by constraint // subsumption whenever it is viable. - //! \at expected.object.cons //! \effects Direct-non-list-initializes `val` or `unex` (matching //! `rhs`'s active member) by trivial copy construction. //! \ensures `rhs.has_value() == this->has_value()`. @@ -189,7 +186,6 @@ class expected { // Move constructor (trivial path). Unconstrained; see the copy // constructor above for why. No explicit noexcept: let the compiler // deduce it, so a non-movable-at-all E deletes rather than mismatches. - //! \at expected.object.cons //! \effects Direct-non-list-initializes `val` or `unex` (matching //! `rhs`'s active member) by trivial move construction. //! \ensures `rhs.has_value() == this->has_value()`. @@ -272,7 +268,6 @@ class expected { // Deleted for reference E with value G: the referent lives inside the unexpected object, so // binding E& to it would dangle once a temporary source is destroyed. Use (unexpect, lvalue), or // an unexpected holding an external object, instead. - //! \at expected.object.cons //! \group cvt-unexpected-ctor-deleted //! \remarks When `E` is a reference type, an overload taking //! `unexpected` for a non-reference `G` is defined as deleted: the @@ -284,7 +279,6 @@ class expected { constexpr expected(const unexpected&) = BEMAN_EXPECTED_DELETE_MSG( "expected: cannot construct from unexpected; the value would dangle — use unexpected"); - //! \at expected.object.cons //! \also cvt-unexpected-ctor-deleted template requires(std::is_reference_v && !std::is_reference_v) @@ -307,7 +301,6 @@ class expected { constexpr explicit expected(unexpect_t, Args&&... args); // Deleted: single argument would bind E& to a temporary — dangling prevention - //! \at expected.object.cons //! \group unexpect-ctor-deleted //! \remarks When `E` is a reference type, an overload with the same //! parameter types is defined as deleted if the single argument would @@ -320,7 +313,6 @@ class expected { // Deleted catch-all: reference E, argument neither constructible nor a dangling case // (e.g. binding a non-const E& from a const lvalue). - //! \at expected.object.cons //! \also unexpect-ctor-deleted template requires(std::is_reference_v && !std::is_constructible_v && @@ -333,7 +325,6 @@ class expected { requires(!std::is_reference_v && std::is_constructible_v&, Args...>) constexpr explicit expected(unexpect_t, std::initializer_list il, Args&&... args); - //! \at expected.object.cons //! \remarks An overload with the same parameter types is defined as //! deleted when `E` is an lvalue reference type. An initializer list //! cannot provide the required long-lived error referent. @@ -342,11 +333,8 @@ class expected { constexpr expected(unexpect_t, std::initializer_list, Args&&...) = BEMAN_EXPECTED_DELETE_MSG( "expected: initializer-list error construction cannot bind a reference; pass an lvalue reference"); - // ------------------------------------------------------------------------- - // [expected.object.dtor] Destructor - // ------------------------------------------------------------------------- + // \ref{expected.object.dtor}, destructor - //! \at expected.object.dtor //! \effects None: `val` or `unex` (whichever is active) has a trivial //! destructor. //! \remarks This destructor is trivial. @@ -357,12 +345,9 @@ class expected { constexpr ~expected() requires(!(std::is_trivially_destructible_v && std::is_trivially_destructible_v)); - // ------------------------------------------------------------------------- - // [expected.object.assign] Assignment - // ------------------------------------------------------------------------- + // \ref{expected.object.assign}, assignment // Copy assignment (trivial path) - //! \at expected.object.assign //! \effects Trivially copies `rhs`'s active member into `*this`. //! \returns `*this`. //! \remarks This operator is trivial. @@ -409,7 +394,6 @@ class expected { = delete; // Move assignment (trivial path) - //! \at expected.object.assign //! \effects Trivially moves `rhs`'s active member into `*this`. //! \returns `*this`. //! \remarks This operator is trivial. @@ -467,7 +451,6 @@ class expected { constexpr expected& operator=(unexpected&& e); // Deleted for reference E with value G: would rebind E& to unexpected's temporary storage. - //! \at expected.object.assign //! \group cvt-unexpected-assign-deleted //! \remarks When `E` is a reference type, an overload taking //! `unexpected` for a non-reference `G` is defined as deleted: it @@ -477,7 +460,6 @@ class expected { constexpr expected& operator=(const unexpected&) = BEMAN_EXPECTED_DELETE_MSG( "expected: cannot assign from unexpected; the value would dangle — use unexpected"); - //! \at expected.object.assign //! \also cvt-unexpected-assign-deleted template requires(std::is_reference_v && !std::is_reference_v) @@ -493,9 +475,7 @@ class expected { requires std::is_nothrow_constructible_v&, Args...> constexpr T& emplace(std::initializer_list il, Args&&... args) noexcept; - // ------------------------------------------------------------------------- - // [expected.object.swap] Swap - // ------------------------------------------------------------------------- + // \ref{expected.object.swap}, swap constexpr void swap(expected& rhs) noexcept(std::is_nothrow_move_constructible_v && std::is_nothrow_swappable_v && @@ -505,7 +485,6 @@ class expected { std::is_move_constructible_v && std::is_move_constructible_v && (std::is_nothrow_move_constructible_v || std::is_nothrow_move_constructible_v)); - //! \at expected.object.swap //! \effects Equivalent to `x.swap(y)`. friend constexpr void swap(expected& x, expected& y) noexcept(noexcept(x.swap(y))) requires(std::is_swappable_v && (std::is_reference_v || std::is_swappable_v) && @@ -515,9 +494,7 @@ class expected { x.swap(y); } - // ------------------------------------------------------------------------- - // [expected.object.obs] Observers - // ------------------------------------------------------------------------- + // \ref{expected.object.obs}, observers constexpr const T* operator->() const noexcept; constexpr T* operator->() noexcept; @@ -554,9 +531,7 @@ class expected { requires(std::is_move_constructible_v && std::is_convertible_v) constexpr error_value_type error_or(G&& def) &&; - // ------------------------------------------------------------------------- - // [expected.object.monadic] Monadic operations - // ------------------------------------------------------------------------- + // \ref{expected.object.monadic}, monadic operations template requires std::is_constructible_v @@ -610,11 +585,8 @@ class expected { requires std::is_constructible_v constexpr auto transform_error(F&& f) const&&; - // ------------------------------------------------------------------------- - // [expected.object.eq] Equality operators (hidden friends) - // ------------------------------------------------------------------------- + // \ref{expected.object.eq}, equality operators - //! \at expected.object.eq //! \mandates `!is_void_v` is `true`. The expression `*x == *y` is //! well-formed and its result is convertible to `bool`. The expression //! `x.error() == y.error()` is well-formed and its result is @@ -632,7 +604,6 @@ class expected { return x.error() == y.error(); } - //! \at expected.object.eq //! \mandates `T2` is not a specialization of `expected`. The expression //! `*x == val` is well-formed and its result is convertible to `bool`. //! \returns `x.has_value() && static_cast(*x == val)`. @@ -642,7 +613,6 @@ class expected { return x.has_value() && static_cast(*x == val); } - //! \at expected.object.eq //! \mandates The expression `x.error() == e.error()` is well-formed and //! its result is convertible to `bool`. //! \returns `!x.has_value() && static_cast(x.error() == @@ -1870,16 +1840,13 @@ class expected { template using rebind = expected; - // ------------------------------------------------------------------------- - // [expected.void.cons] Constructors - // ------------------------------------------------------------------------- + // \ref{expected.void.cons}, constructors constexpr expected() noexcept; // Unconstrained trivial-path candidate: see the primary template's copy // constructor for why (the sole declaration when E is not copy // constructible at all; subsumed by the non-trivial path otherwise). - //! \at expected.void.cons //! \merge constexpr expected(const expected&) = default; @@ -1888,7 +1855,6 @@ class expected { // Unconstrained; no explicit noexcept — see the primary template's move // constructor for why. - //! \at expected.void.cons //! \merge constexpr expected(expected&&) = default; @@ -1939,7 +1905,6 @@ class expected { // Deleted for reference E with value G: the referent lives inside the temporary unexpected, so // binding E& to it would dangle once the source is destroyed. Use (unexpect, lvalue) instead. - //! \at expected.void.cons //! \group void-cvt-unexpected-ctor-deleted //! \remarks When `E` is a reference type, an overload taking //! `unexpected` for a non-reference `G` is defined as deleted: the @@ -1951,7 +1916,6 @@ class expected { constexpr expected(const unexpected&) = BEMAN_EXPECTED_DELETE_MSG( "expected: cannot construct from unexpected; the value would dangle — use unexpected"); - //! \at expected.void.cons //! \also void-cvt-unexpected-ctor-deleted template requires(std::is_reference_v && !std::is_reference_v) @@ -1967,7 +1931,6 @@ class expected { constexpr explicit expected(unexpect_t, Args&&... args); // Deleted: single argument would bind E& to a temporary — dangling prevention - //! \at expected.void.cons //! \group void-unexpect-ctor-deleted //! \remarks When `E` is a reference type, an overload with the same //! parameter types is defined as deleted if the single argument would @@ -1980,7 +1943,6 @@ class expected { // Deleted catch-all: reference E, argument neither constructible nor a dangling case // (e.g. binding a non-const E& from a const lvalue). - //! \at expected.void.cons //! \also void-unexpect-ctor-deleted template requires(std::is_reference_v && !std::is_constructible_v && @@ -1993,7 +1955,6 @@ class expected { requires(!std::is_reference_v && std::is_constructible_v&, Args...>) constexpr explicit expected(unexpect_t, std::initializer_list il, Args&&... args); - //! \at expected.void.cons //! \remarks An overload with the same parameter types is defined as //! deleted when `E` is an lvalue reference type. An initializer list //! cannot provide the required long-lived error referent. @@ -2017,11 +1978,8 @@ class expected { !detail::reference_constructs_from_temporary_v) constexpr explicit(!std::is_convertible_v) expected(expected&& rhs); - // ------------------------------------------------------------------------- - // [expected.void.dtor] Destructor - // ------------------------------------------------------------------------- + // \ref{expected.void.dtor}, destructor - //! \at expected.void.dtor //! \merge constexpr ~expected() requires std::is_trivially_destructible_v @@ -2030,12 +1988,9 @@ class expected { constexpr ~expected() requires(!std::is_trivially_destructible_v); - // ------------------------------------------------------------------------- - // [expected.void.assign] Assignment - // ------------------------------------------------------------------------- + // \ref{expected.void.assign}, assignment // Copy assignment (trivial path) - //! \at expected.void.assign //! \merge constexpr expected& operator=(const expected&) requires(std::is_trivially_copy_constructible_v && std::is_trivially_copy_assignable_v && @@ -2057,7 +2012,6 @@ class expected { = delete; // Move assignment (trivial path) - //! \at expected.void.assign //! \merge constexpr expected& operator=(expected&&) noexcept requires(std::is_trivially_move_constructible_v && std::is_trivially_move_assignable_v && @@ -2092,7 +2046,6 @@ class expected { constexpr expected& operator=(unexpected&& e); // Deleted for reference E with value G: would bind E& to storage inside the temporary unexpected. - //! \at expected.void.assign //! \group void-cvt-unexpected-assign-deleted //! \remarks When `E` is a reference type, an overload taking //! `unexpected` for a non-reference `G` is defined as deleted: it @@ -2102,7 +2055,6 @@ class expected { constexpr expected& operator=(const unexpected&) = BEMAN_EXPECTED_DELETE_MSG( "expected: cannot assign from unexpected; the value would dangle — use unexpected"); - //! \at expected.void.assign //! \also void-cvt-unexpected-assign-deleted template requires(std::is_reference_v && !std::is_reference_v) @@ -2111,15 +2063,12 @@ class expected { constexpr void emplace() noexcept; - // ------------------------------------------------------------------------- - // [expected.void.swap] Swap - // ------------------------------------------------------------------------- + // \ref{expected.void.swap}, swap constexpr void swap(expected& rhs) noexcept(std::is_nothrow_move_constructible_v && (std::is_reference_v || std::is_nothrow_swappable_v)) requires((std::is_reference_v || std::is_swappable_v) && std::is_move_constructible_v); - //! \at expected.void.swap //! \effects Equivalent to `x.swap(y)`. friend constexpr void swap(expected& x, expected& y) noexcept(noexcept(x.swap(y))) requires((std::is_reference_v || std::is_swappable_v) && std::is_move_constructible_v) @@ -2127,9 +2076,7 @@ class expected { x.swap(y); } - // ------------------------------------------------------------------------- - // [expected.void.obs] Observers - // ------------------------------------------------------------------------- + // \ref{expected.void.obs}, observers constexpr explicit operator bool() const noexcept; constexpr bool has_value() const noexcept; @@ -2157,7 +2104,6 @@ class expected { // Deleted: value_or is not available for void expected. Gated to reference E only so that, // for value E, no value_or overload is declared at all (there is nothing to delete against). - //! \at expected.void.obs //! \remarks `expected` has no `value_or` member: there is no //! value to fall back from. This overload exists only to give a clear //! diagnostic when `E` is a reference type, and is defined as deleted. @@ -2167,9 +2113,7 @@ class expected { BEMAN_EXPECTED_DELETE_MSG("expected: value_or is not defined for void value_type; there is no " "value to fall back from — use has_value()/error()"); - // ------------------------------------------------------------------------- - // [expected.void.monadic] Monadic operations - // ------------------------------------------------------------------------- + // \ref{expected.void.monadic}, monadic operations template requires std::is_constructible_v @@ -2215,11 +2159,8 @@ class expected { template constexpr auto transform_error(F&& f) const&&; - // ------------------------------------------------------------------------- - // [expected.void.eq] Equality operators (hidden friends) - // ------------------------------------------------------------------------- + // \ref{expected.void.eq}, equality operators - //! \at expected.void.eq //! \mandates `is_void_v` is `true`. The expression `x.error() == //! y.error()` is well-formed and its result is convertible to `bool`. //! \returns If `x.has_value() != y.has_value()`, `false`; otherwise, if @@ -2235,7 +2176,6 @@ class expected { return x.error() == y.error(); } - //! \at expected.void.eq //! \mandates The expression `x.error() == e.error()` is well-formed and //! its result is convertible to `bool`. //! \returns `!x.has_value() && static_cast(x.error() == @@ -3151,11 +3091,8 @@ class expected { template using rebind = expected; - // ------------------------------------------------------------------------- - // Constructors - // ------------------------------------------------------------------------- + // \ref{expected.ref.cons}, constructors - //! \at expected.ref.cons //! \remarks `expected` has no default constructor: a reference //! cannot be null, so there is no empty state to default-construct //! into. @@ -3163,7 +3100,6 @@ class expected { // Copy constructor (trivial path). Unconstrained; see the primary // template's copy constructor for why. - //! \at expected.ref.cons //! \effects If `rhs.has_value()` is `true`, initializes `val` with //! `rhs.val`, so that `*this` and `rhs` refer to the same object; //! otherwise, initializes `unex` with `rhs.unex`. @@ -3176,7 +3112,6 @@ class expected { requires(std::is_copy_constructible_v && !std::is_trivially_copy_constructible_v); // Move constructor (trivial path). Unconstrained; no explicit noexcept. - //! \at expected.ref.cons //! \effects If `rhs.has_value()` is `true`, initializes `val` with //! `rhs.val`, so that `*this` and `rhs` refer to the same object; //! otherwise, initializes `unex` with `std::move(rhs.unex)`. @@ -3189,7 +3124,6 @@ class expected { requires(std::is_move_constructible_v && !std::is_trivially_move_constructible_v); // Deleted: no in-place value constructor — T& cannot be constructed in-place - //! \at expected.ref.cons //! \remarks `expected` has no in-place value constructor: `T&` //! cannot be constructed in-place. Pass a `U` convertible to `T&` //! instead. @@ -3199,7 +3133,6 @@ class expected { "in-place — pass a U convertible to T&"); // Value constructor — takes U that can bind to T& - //! \at expected.ref.cons //! \constraints `remove_cvref_t` is not `in_place_t`, `expected`, or //! a specialization of `unexpected`; `is_constructible_v` is //! `true`; and `reference_constructs_from_temporary_v` is @@ -3219,7 +3152,6 @@ class expected { } // Deleted: binding a temporary to T& creates a dangling reference - //! \at expected.ref.cons //! \remarks A constructor for which //! `reference_constructs_from_temporary_v` is `true` — one that //! would bind `T&` to a temporary — is defined as deleted. @@ -3279,7 +3211,6 @@ class expected { // Deleted for reference E with value G: the referent lives inside the unexpected object, so // binding E& to it would dangle once a temporary source is destroyed. Use (unexpect, lvalue), or // an unexpected holding an external object, instead. - //! \at expected.ref.cons //! \group ref-cvt-unexpected-ctor-deleted //! \remarks When `E` is a reference type, an overload taking //! `unexpected` for a non-reference `G` is defined as deleted: the @@ -3291,7 +3222,6 @@ class expected { constexpr expected(const unexpected&) = BEMAN_EXPECTED_DELETE_MSG( "expected: cannot construct from unexpected; the value would dangle — use unexpected"); - //! \at expected.ref.cons //! \also ref-cvt-unexpected-ctor-deleted template requires(std::is_reference_v && !std::is_reference_v) @@ -3304,7 +3234,6 @@ class expected { constexpr explicit expected(unexpect_t, Args&&... args); // Deleted: single argument would bind E& to a temporary — dangling prevention - //! \at expected.ref.cons //! \group ref-unexpect-ctor-deleted //! \remarks When `E` is a reference type, an overload with the same //! parameter types is defined as deleted if the single argument would @@ -3316,7 +3245,6 @@ class expected { "expected: unexpect argument would bind a temporary that dangles; pass an lvalue reference"); // Deleted catch-all: reference E, argument neither constructible nor a dangling case - //! \at expected.ref.cons //! \also ref-unexpect-ctor-deleted template requires(std::is_reference_v && !std::is_constructible_v && @@ -3329,7 +3257,6 @@ class expected { requires(!std::is_reference_v && std::is_constructible_v&, Args...>) constexpr explicit expected(unexpect_t, std::initializer_list il, Args&&... args); - //! \at expected.ref.cons //! \remarks An overload with the same parameter types is defined as //! deleted when `E` is an lvalue reference type. An initializer list //! cannot provide the required long-lived error referent. @@ -3338,11 +3265,8 @@ class expected { constexpr expected(unexpect_t, std::initializer_list, Args&&...) = BEMAN_EXPECTED_DELETE_MSG( "expected: initializer-list error construction cannot bind a reference; pass an lvalue reference"); - // ------------------------------------------------------------------------- - // Destructor - // ------------------------------------------------------------------------- + // \ref{expected.ref.dtor}, destructor - //! \at expected.ref.dtor //! \effects None: `*this` never owns the object it refers to; `T` is //! never destroyed. //! \remarks This destructor is trivial. @@ -3353,12 +3277,9 @@ class expected { constexpr ~expected() requires(!std::is_trivially_destructible_v); - // ------------------------------------------------------------------------- - // Assignment (rebind semantics) - // ------------------------------------------------------------------------- + // \ref{expected.ref.assign}, assignment // Copy assignment (trivial path) - //! \at expected.ref.assign //! \effects If `rhs.has_value()` is `true`: if `has_value()` is `true`, //! assigns `rhs.val` to `val`; otherwise destroys `unex` and //! initializes `val` with `rhs.val`. If `rhs.has_value()` is `false`, @@ -3389,7 +3310,6 @@ class expected { = delete; // Move assignment (trivial path) - //! \at expected.ref.assign //! \effects If `rhs.has_value()` is `true`: if `has_value()` is `true`, //! assigns `rhs.val` to `val`; otherwise destroys `unex` and //! initializes `val` with `rhs.val`. If `rhs.has_value()` is `false`, @@ -3410,7 +3330,6 @@ class expected { std::is_trivially_destructible_v)); // Rebind reference from lvalue - //! \at expected.ref.assign //! \constraints `remove_cvref_t` is neither `expected` nor a //! specialization of `unexpected`, `is_constructible_v` is //! `true`, and `reference_constructs_from_temporary_v` is @@ -3459,7 +3378,6 @@ class expected { constexpr expected& operator=(unexpected&& e); // Deleted for reference E with value G: would rebind E& to unexpected's temporary storage. - //! \at expected.ref.assign //! \group ref-cvt-unexpected-assign-deleted //! \remarks When `E` is a reference type, an overload taking //! `unexpected` for a non-reference `G` is defined as deleted: it @@ -3469,7 +3387,6 @@ class expected { constexpr expected& operator=(const unexpected&) = BEMAN_EXPECTED_DELETE_MSG( "expected: cannot assign from unexpected; the value would dangle — use unexpected"); - //! \at expected.ref.assign //! \also ref-cvt-unexpected-assign-deleted template requires(std::is_reference_v && !std::is_reference_v) @@ -3481,15 +3398,12 @@ class expected { requires(std::is_constructible_v && !detail::reference_constructs_from_temporary_v) constexpr T& emplace(U&& u) noexcept(std::is_nothrow_constructible_v); - // ------------------------------------------------------------------------- - // Swap - // ------------------------------------------------------------------------- + // \ref{expected.ref.swap}, swap constexpr void swap(expected& rhs) noexcept(std::is_nothrow_move_constructible_v && (std::is_reference_v || std::is_nothrow_swappable_v)) requires((std::is_reference_v || std::is_swappable_v) && std::is_move_constructible_v); - //! \at expected.ref.swap //! \effects Equivalent to `x.swap(y)`. friend constexpr void swap(expected& x, expected& y) noexcept(noexcept(x.swap(y))) requires((std::is_reference_v || std::is_swappable_v) && std::is_move_constructible_v) @@ -3497,9 +3411,7 @@ class expected { x.swap(y); } - // ------------------------------------------------------------------------- - // Observers - // ------------------------------------------------------------------------- + // \ref{expected.ref.obs}, observers constexpr T* operator->() const noexcept; constexpr T& operator*() const noexcept; @@ -3533,9 +3445,7 @@ class expected { std::is_convertible_v>>) constexpr error_value_type error_or(G&& def) &&; - // ------------------------------------------------------------------------- - // Monadic operations - // ------------------------------------------------------------------------- + // \ref{expected.ref.monadic}, monadic operations template requires std::is_constructible_v @@ -3583,11 +3493,8 @@ class expected { template constexpr auto transform_error(F&& f) const&&; - // ------------------------------------------------------------------------- - // Equality operators (hidden friends) - // ------------------------------------------------------------------------- + // \ref{expected.ref.eq}, equality operators - //! \at expected.ref.eq //! \mandates `!is_void_v` is `true`. The expression `*x == *y` is //! well-formed and its result is convertible to `bool`. The expression //! `x.error() == y.error()` is well-formed and its result is @@ -3608,7 +3515,6 @@ class expected { return x.error() == y.error(); } - //! \at expected.ref.eq //! \mandates `T2` is not a specialization of `expected`. The expression //! `*x == val` is well-formed and its result is convertible to `bool`. //! \returns `x.has_value() && static_cast(*x == val)`. @@ -3618,7 +3524,6 @@ class expected { return x.has_value() && static_cast(*x == val); } - //! \at expected.ref.eq //! \mandates The expression `x.error() == e.error()` is well-formed and //! its result is convertible to `bool`. //! \returns `!x.has_value() && static_cast(x.error() == diff --git a/include/beman/expected/unexpected.hpp b/include/beman/expected/unexpected.hpp index 43936ae7..010031dd 100644 --- a/include/beman/expected/unexpected.hpp +++ b/include/beman/expected/unexpected.hpp @@ -76,10 +76,10 @@ class unexpected { "unexpected: E must not be a specialization of unexpected"); public: + // \ref{expected.un.cons}, constructors constexpr unexpected(const unexpected&) = default; constexpr unexpected(unexpected&&) = default; - //! \at expected.un.cons //! \constraints //! \item `is_same_v, unexpected>` is `false`; and //! \item `is_same_v, in_place_t>` is `false`; and @@ -93,7 +93,6 @@ class unexpected { constexpr explicit unexpected(Err&& e) noexcept(std::is_nothrow_constructible_v) : unex_(std::forward(e)) {} - //! \at expected.un.cons //! \constraints `is_constructible_v` is `true`. //! \effects Direct-non-list-initializes `unex` with //! `std::forward(args)...`. @@ -104,7 +103,6 @@ class unexpected { Args&&... args) noexcept(std::is_nothrow_constructible_v) : unex_(std::forward(args)...) {} - //! \at expected.un.cons //! \constraints `is_constructible_v&, Args...>` is //! `true`. //! \effects Direct-non-list-initializes `unex` with `il, diff --git a/papers/wording/expected.tex b/papers/wording/expected.tex index abcaf435..4a295c72 100644 --- a/papers/wording/expected.tex +++ b/papers/wording/expected.tex @@ -26,6 +26,7 @@ template class @\libglobal{unexpected}@ { public: + // \ref{expected.un.cons}, constructors constexpr unexpected(const unexpected&) = default; constexpr unexpected(unexpected&&) = default; @@ -351,17 +352,6 @@ \rSec2[expected.bad]{Class template \tcode{bad_expected_access}} -\indexlibrarymember{what}{bad_expected_access}% -\begin{itemdecl} -const char* what() const noexcept override; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\returns -An \impldef{return value of \tcode{bad_expected_access::what}} \ntbs{}, which during constant evaluation is encoded with the ordinary literal encoding\iref{lex.ccon}. -\end{itemdescr} - \begin{codeblock} namespace std { template @@ -474,6 +464,17 @@ } \end{codeblock} +\indexlibrarymember{what}{bad_expected_access}% +\begin{itemdecl} +const char* what() const noexcept override; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +An \impldef{return value of \tcode{bad_expected_access::what}} \ntbs{}, which during constant evaluation is encoded with the ordinary literal encoding\iref{lex.ccon}. +\end{itemdescr} + \rSec2[expected.expected]{Class template \tcode{expected}} \rSec3[expected.object.general]{General} @@ -492,6 +493,8 @@ template using rebind = expected; + // \ref{expected.object.cons}, constructors + constexpr expected() noexcept(is_nothrow_default_constructible_v); constexpr expected(const expected&) = default; @@ -562,10 +565,14 @@ template constexpr expected(unexpect_t, initializer_list, Args&&...) = delete; + // \ref{expected.object.dtor}, destructor + constexpr ~expected() = default; constexpr ~expected(); + // \ref{expected.object.assign}, assignment + constexpr expected& operator=(const expected&) = default; constexpr expected& operator=(const expected& rhs) noexcept( @@ -599,6 +606,8 @@ template constexpr T& emplace(initializer_list il, Args&&... args) noexcept; + // \ref{expected.object.swap}, swap + constexpr void swap(expected& rhs) noexcept(is_nothrow_move_constructible_v && is_nothrow_swappable_v && is_nothrow_move_constructible_v && @@ -607,6 +616,8 @@ friend constexpr void swap(expected& x, expected& y) noexcept(noexcept(x.swap(y))); + // \ref{expected.object.obs}, observers + constexpr const T* operator->() const noexcept; constexpr T* operator->() noexcept; @@ -638,6 +649,8 @@ template constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; + // \ref{expected.object.monadic}, monadic operations + template constexpr auto and_then(F&& f) &; template constexpr auto and_then(F&& f) &&; template constexpr auto and_then(F&& f) const&; @@ -658,6 +671,8 @@ template constexpr auto transform_error(F&& f) const&; template constexpr auto transform_error(F&& f) const&&; + // \ref{expected.object.eq}, equality operators + template friend constexpr bool operator==(const expected& x, const expected& y); @@ -1883,6 +1898,8 @@ template using rebind = expected; + // \ref{expected.void.cons}, constructors + constexpr expected() noexcept; constexpr expected(const expected& rhs) noexcept( @@ -1940,8 +1957,12 @@ template constexpr explicit(!is_convertible_v) expected(expected&& rhs); + // \ref{expected.void.dtor}, destructor + constexpr ~expected(); + // \ref{expected.void.assign}, assignment + constexpr expected& operator=(const expected& rhs) noexcept( is_nothrow_copy_constructible_v && is_nothrow_copy_assignable_v); @@ -1964,12 +1985,16 @@ constexpr void emplace() noexcept; + // \ref{expected.void.swap}, swap + constexpr void swap(expected& rhs) noexcept(is_nothrow_move_constructible_v && (is_reference_v || is_nothrow_swappable_v)); friend constexpr void swap(expected& x, expected& y) noexcept(noexcept(x.swap(y))); + // \ref{expected.void.obs}, observers + constexpr explicit operator bool() const noexcept; constexpr bool has_value() const noexcept; @@ -1991,6 +2016,8 @@ template constexpr void value_or(U&&) const = delete; + // \ref{expected.void.monadic}, monadic operations + template constexpr auto and_then(F&& f) &; template constexpr auto and_then(F&& f) &&; template constexpr auto and_then(F&& f) const&; @@ -2011,6 +2038,8 @@ template constexpr auto transform_error(F&& f) const&; template constexpr auto transform_error(F&& f) const&&; + // \ref{expected.void.eq}, equality operators + template friend constexpr bool operator==(const expected& x, const expected& y); @@ -2865,6 +2894,8 @@ template using rebind = expected; + // \ref{expected.ref.cons}, constructors + expected() = delete; constexpr expected(const expected&) = default; @@ -2934,10 +2965,14 @@ template constexpr expected(unexpect_t, initializer_list, Args&&...) = delete; + // \ref{expected.ref.dtor}, destructor + constexpr ~expected() = default; constexpr ~expected(); + // \ref{expected.ref.assign}, assignment + constexpr expected& operator=(const expected&) = default; constexpr expected& operator=(const expected& rhs) noexcept( @@ -2967,12 +3002,16 @@ template constexpr T& emplace(U&& u) noexcept(is_nothrow_constructible_v); + // \ref{expected.ref.swap}, swap + constexpr void swap(expected& rhs) noexcept(is_nothrow_move_constructible_v && (is_reference_v || is_nothrow_swappable_v)); friend constexpr void swap(expected& x, expected& y) noexcept(noexcept(x.swap(y))); + // \ref{expected.ref.obs}, observers + constexpr T* operator->() const noexcept; constexpr T& operator*() const noexcept; @@ -2995,6 +3034,8 @@ template constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; + // \ref{expected.ref.monadic}, monadic operations + template constexpr auto and_then(F&& f) &; template constexpr auto and_then(F&& f) &&; template constexpr auto and_then(F&& f) const&; @@ -3015,6 +3056,8 @@ template constexpr auto transform_error(F&& f) const&; template constexpr auto transform_error(F&& f) const&&; + // \ref{expected.ref.eq}, equality operators + template friend constexpr bool operator==(const expected& x, const expected& y); diff --git a/papers/wording/fragments/expected.bad.tex b/papers/wording/fragments/expected.bad.tex index beca9dcd..890ef45a 100644 --- a/papers/wording/fragments/expected.bad.tex +++ b/papers/wording/fragments/expected.bad.tex @@ -1,16 +1,5 @@ \rSec2[expected.bad]{Class template \tcode{bad_expected_access}} -\indexlibrarymember{what}{bad_expected_access}% -\begin{itemdecl} -const char* what() const noexcept override; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\returns -An \impldef{return value of \tcode{bad_expected_access::what}} \ntbs{}, which during constant evaluation is encoded with the ordinary literal encoding\iref{lex.ccon}. -\end{itemdescr} - \begin{codeblock} namespace std { template diff --git a/papers/wording/fragments/expected.bad.void.tex b/papers/wording/fragments/expected.bad.void.tex index c06637b4..bafa2d27 100644 --- a/papers/wording/fragments/expected.bad.void.tex +++ b/papers/wording/fragments/expected.bad.void.tex @@ -21,3 +21,14 @@ }; } \end{codeblock} + +\indexlibrarymember{what}{bad_expected_access}% +\begin{itemdecl} +const char* what() const noexcept override; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +An \impldef{return value of \tcode{bad_expected_access::what}} \ntbs{}, which during constant evaluation is encoded with the ordinary literal encoding\iref{lex.ccon}. +\end{itemdescr} diff --git a/papers/wording/fragments/expected.expected.tex b/papers/wording/fragments/expected.expected.tex index d76f6114..4dc80c7c 100644 --- a/papers/wording/fragments/expected.expected.tex +++ b/papers/wording/fragments/expected.expected.tex @@ -16,6 +16,8 @@ template using rebind = expected; + // \ref{expected.object.cons}, constructors + constexpr expected() noexcept(is_nothrow_default_constructible_v); constexpr expected(const expected&) = default; @@ -86,10 +88,14 @@ template constexpr expected(unexpect_t, initializer_list, Args&&...) = delete; + // \ref{expected.object.dtor}, destructor + constexpr ~expected() = default; constexpr ~expected(); + // \ref{expected.object.assign}, assignment + constexpr expected& operator=(const expected&) = default; constexpr expected& operator=(const expected& rhs) noexcept( @@ -123,6 +129,8 @@ template constexpr T& emplace(initializer_list il, Args&&... args) noexcept; + // \ref{expected.object.swap}, swap + constexpr void swap(expected& rhs) noexcept(is_nothrow_move_constructible_v && is_nothrow_swappable_v && is_nothrow_move_constructible_v && @@ -131,6 +139,8 @@ friend constexpr void swap(expected& x, expected& y) noexcept(noexcept(x.swap(y))); + // \ref{expected.object.obs}, observers + constexpr const T* operator->() const noexcept; constexpr T* operator->() noexcept; @@ -162,6 +172,8 @@ template constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; + // \ref{expected.object.monadic}, monadic operations + template constexpr auto and_then(F&& f) &; template constexpr auto and_then(F&& f) &&; template constexpr auto and_then(F&& f) const&; @@ -182,6 +194,8 @@ template constexpr auto transform_error(F&& f) const&; template constexpr auto transform_error(F&& f) const&&; + // \ref{expected.object.eq}, equality operators + template friend constexpr bool operator==(const expected& x, const expected& y); diff --git a/papers/wording/fragments/expected.ref.tex b/papers/wording/fragments/expected.ref.tex index acfd6fa7..c04cf20b 100644 --- a/papers/wording/fragments/expected.ref.tex +++ b/papers/wording/fragments/expected.ref.tex @@ -16,6 +16,8 @@ template using rebind = expected; + // \ref{expected.ref.cons}, constructors + expected() = delete; constexpr expected(const expected&) = default; @@ -85,10 +87,14 @@ template constexpr expected(unexpect_t, initializer_list, Args&&...) = delete; + // \ref{expected.ref.dtor}, destructor + constexpr ~expected() = default; constexpr ~expected(); + // \ref{expected.ref.assign}, assignment + constexpr expected& operator=(const expected&) = default; constexpr expected& operator=(const expected& rhs) noexcept( @@ -118,12 +124,16 @@ template constexpr T& emplace(U&& u) noexcept(is_nothrow_constructible_v); + // \ref{expected.ref.swap}, swap + constexpr void swap(expected& rhs) noexcept(is_nothrow_move_constructible_v && (is_reference_v || is_nothrow_swappable_v)); friend constexpr void swap(expected& x, expected& y) noexcept(noexcept(x.swap(y))); + // \ref{expected.ref.obs}, observers + constexpr T* operator->() const noexcept; constexpr T& operator*() const noexcept; @@ -146,6 +156,8 @@ template constexpr @\exposid{error-value-type}@ error_or(G&& def) &&; + // \ref{expected.ref.monadic}, monadic operations + template constexpr auto and_then(F&& f) &; template constexpr auto and_then(F&& f) &&; template constexpr auto and_then(F&& f) const&; @@ -166,6 +178,8 @@ template constexpr auto transform_error(F&& f) const&; template constexpr auto transform_error(F&& f) const&&; + // \ref{expected.ref.eq}, equality operators + template friend constexpr bool operator==(const expected& x, const expected& y); diff --git a/papers/wording/fragments/expected.unexpected.tex b/papers/wording/fragments/expected.unexpected.tex index 941e92be..a4f53326 100644 --- a/papers/wording/fragments/expected.unexpected.tex +++ b/papers/wording/fragments/expected.unexpected.tex @@ -7,6 +7,7 @@ template class @\libglobal{unexpected}@ { public: + // \ref{expected.un.cons}, constructors constexpr unexpected(const unexpected&) = default; constexpr unexpected(unexpected&&) = default; diff --git a/papers/wording/fragments/expected.void.tex b/papers/wording/fragments/expected.void.tex index 93f78ea9..d1ec6c15 100644 --- a/papers/wording/fragments/expected.void.tex +++ b/papers/wording/fragments/expected.void.tex @@ -16,6 +16,8 @@ template using rebind = expected; + // \ref{expected.void.cons}, constructors + constexpr expected() noexcept; constexpr expected(const expected& rhs) noexcept( @@ -73,8 +75,12 @@ template constexpr explicit(!is_convertible_v) expected(expected&& rhs); + // \ref{expected.void.dtor}, destructor + constexpr ~expected(); + // \ref{expected.void.assign}, assignment + constexpr expected& operator=(const expected& rhs) noexcept( is_nothrow_copy_constructible_v && is_nothrow_copy_assignable_v); @@ -97,12 +103,16 @@ constexpr void emplace() noexcept; + // \ref{expected.void.swap}, swap + constexpr void swap(expected& rhs) noexcept(is_nothrow_move_constructible_v && (is_reference_v || is_nothrow_swappable_v)); friend constexpr void swap(expected& x, expected& y) noexcept(noexcept(x.swap(y))); + // \ref{expected.void.obs}, observers + constexpr explicit operator bool() const noexcept; constexpr bool has_value() const noexcept; @@ -124,6 +134,8 @@ template constexpr void value_or(U&&) const = delete; + // \ref{expected.void.monadic}, monadic operations + template constexpr auto and_then(F&& f) &; template constexpr auto and_then(F&& f) &&; template constexpr auto and_then(F&& f) const&; @@ -144,6 +156,8 @@ template constexpr auto transform_error(F&& f) const&; template constexpr auto transform_error(F&& f) const&&; + // \ref{expected.void.eq}, equality operators + template friend constexpr bool operator==(const expected& x, const expected& y); From 0721f09b167e4c602512ad700183005c0330c928 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 11:21:55 -0500 Subject: [PATCH 11/12] Record the member-routing stage of the specgen catch-up --- docs/plan/specgen-catchup.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/plan/specgen-catchup.md b/docs/plan/specgen-catchup.md index a18d4000..a5ef13de 100644 --- a/docs/plan/specgen-catchup.md +++ b/docs/plan/specgen-catchup.md @@ -13,10 +13,13 @@ which are the headers on `main`, and the working draft at `65890fab` **Earlier rounds:** 0.23.0, then 0.41.1 (`9d1689d`) on 2026-11-16, then 0.42.3 and 0.43.0 on 2026-11-17 and 18. Where a number moved, the earlier one is given beside it. -**Progress:** stages 1 to 6 are done, 2026-11-19, as seven commits on this -branch on top of #117's head. Each stage below says what it did. Next is -[member-routing](#member-routing); [macro-specifiers](#macro-specifiers) -waits on specgen. +**Progress:** stages 1 to 6 and 8 are done, 2026-11-19, as commits on this +branch on top of #117's head. Each stage below says what it did. +[macro-specifiers](#macro-specifiers) waits on specgen#377. Next is +[synopsis-shape](#synopsis-shape), which needs +[overload-partitions](#overload-partitions) and +[implementation-extras](#implementation-extras) ruled on first; +[api-site](#api-site) is independent of both. --- @@ -505,6 +508,19 @@ added: `bad_expected_access::what()` is routed to `[expected.bad.void]`. Check: item placement is unchanged but for that one, and the synopses gain the paper's 22 group headers. +Done (`65eab56`). 21 banners in the three `expected` classes became group +comments and `unexpected` gained its one, 22 in all; 56 `\at` markers went, +and 16 remain: 14 in `unexpected.hpp`, whose members after the constructors +sit outside any group in the draft's synopsis, and the two that place a +class's own wording in its `.general` subclause. The wording gained the 22 +comment lines and lost nothing. `\at` does not route an out-of-line +definition, so `bad_expected_access::what()` was moved instead: its +definition now follows its class, ahead of the section comment for the +primary template. `[expected.bad]` opens with its synopsis and +`[expected.bad.void]` has its item, and the removed block in that clause's +draft diff is gone. Code only in the generated wording is 1576 tokens, and +only in the paper 748. + ### Stage 9 — [synopsis-shape](#synopsis-shape) Bring the class synopses to the draft's shape. What is left of it: From 644cedf19f51add5127e69d1b4286b816480255b Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Thu, 19 Nov 2026 15:47:12 -0500 Subject: [PATCH 12/12] Bring the plan's commit references up to date after rebasing onto #117 --- docs/plan/specgen-catchup.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/plan/specgen-catchup.md b/docs/plan/specgen-catchup.md index a5ef13de..153995ee 100644 --- a/docs/plan/specgen-catchup.md +++ b/docs/plan/specgen-catchup.md @@ -1,12 +1,12 @@ # Plan: specgen-catchup -**Branch:** `specgen-catchup` (from `upstream/main` at `396d94d`) +**Branch:** `specgen-catchup` (from `upstream/main` at `669166b`) **Read first:** the specgen user guide (`~/src/specgen/main/docs/user-guide.md`, specgen 0.47.0) and `papers/wording/README.md`. -**Depends on:** [#117](https://github.com/bemanproject/expected/pull/117), -which adds `make clean-wording` and regenerates the checked-in wording, with -specgen 0.23.0 and then with 0.41.1 (`b796f6c`). It is open and mergeable. -This plan's stages start from that wording. +**Builds on:** [#117](https://github.com/bemanproject/expected/pull/117), +which added `make clean-wording` and regenerated the checked-in wording, with +specgen 0.23.0 and then with 0.41.1 (`b796f6c`). It merged on 2026-11-19 as +`669166b`. This plan's stages start from that wording. **Measured with:** specgen 0.47.0 (`6c50a01`) on the headers at `396d94d`, which are the headers on `main`, and the working draft at `65890fab` (2026-11-17), whose `[expected]` is the same as at `3e3793aa` and `2594eff0`. @@ -14,7 +14,7 @@ which are the headers on `main`, and the working draft at `65890fab` 0.42.3 and 0.43.0 on 2026-11-17 and 18. Where a number moved, the earlier one is given beside it. **Progress:** stages 1 to 6 and 8 are done, 2026-11-19, as commits on this -branch on top of #117's head. Each stage below says what it did. +branch, rebased onto `upstream/main` once #117 had merged. Each stage below says what it did. [macro-specifiers](#macro-specifiers) waits on specgen#377. Next is [synopsis-shape](#synopsis-shape), which needs [overload-partitions](#overload-partitions) and @@ -124,7 +124,7 @@ builds `expected-clean.tex` by splicing the hand-written head of `strip-wording.py`) onto that file. The paper itself `\include`s `expected-new.tex` and uses no generated text. -The checked-in wording on `main` is specgen 0.4.0's. #117 carries 0.41.1's. +The checked-in wording on `main` is specgen 0.41.1's, from #117. ### The gap to the paper, measured @@ -380,7 +380,7 @@ definition's, and delete the in-class copy. Check: no `error:` line from `generate`, exit status 0, and the `[expected.ref]` fragment changes only where a difference was settled. -Done (`5865daf`, `2bd9439`). Five of the seven pairs said the same thing. +Done (`1846970`, `0034e47`). Five of the seven pairs said the same thing. Deleting all seven left the render byte for byte as it was, and the run exits 0. The other two were the move constructor and the move assignment operator. Each is the second declaration of a grouped item whose description @@ -402,9 +402,9 @@ it. Done once already, for 0.41.1, as the third commit of #117 (`b796f6c`). The stage recurs whenever specgen changes its render; see [specgen-pin](#specgen-pin). #117 can merge as it is, with this stage's -commit following it, or take this commit as a fourth. +commit following it, or take this commit as a fourth. It merged as it was. -Done for 0.47.0 (`c9d9569`), with `--warnings-as-errors` in the specgen call +Done for 0.47.0 (`3882f08`), with `--warnings-as-errors` in the specgen call and a paragraph in `papers/wording/README.md` on what fails the run. ### Stage 3 — [gap-yardstick](#gap-yardstick) @@ -416,7 +416,7 @@ draft. It does not fail the build. It needs a draft checkout does to these numbers. The counts in this plan were made by hand each round, and the scripts were not kept, which is the reason for the goal. -Done (`2a0102d`): `make wording-gap DRAFT_SOURCE=/source`, counted by +Done (`23188c3`): `make wording-gap DRAFT_SOURCE=/source`, counted by `papers/wording-gap.py`. On the 0.41.1 wording it gives the numbers of the token table above, and for the paper's marks the last column of the draft table. After stage 6, against the draft at `65890fab`: @@ -440,7 +440,7 @@ table. After stage 6, against the draft at `65890fab`: goes from 0 to 27 and `\tcode{has_val}` to 0. Move the two `\omit` rationales back above their members. -Done (`03f0c92`). 27, and 0. The note on the deleted copy assignment is +Done (`cf465bd`). 27, and 0. The note on the deleted copy assignment is above the primary template's `\omit`ted overload, and the note on `void_` is above that member in the union. Neither changed the wording. @@ -450,7 +450,7 @@ Write the 7 titles that name code with backticks, as prose does: ``{Partial specialization `unexpected`}``. Check: each renders with `\tcode{...}` and matches the paper's title. -Done (`7d5214b`). Every heading of the generated wording, title and stable +Done (`54989d4`). Every heading of the generated wording, title and stable name, is now the same as the paper's. ### Stage 6 — [draft-prose-macros](#draft-prose-macros) @@ -470,7 +470,7 @@ words or get them slightly wrong: Check: the sentences changed read as the draft's do, and no other paragraph of the plain render changes. -Done (`8516f2c`). `what()` twice; `\iref{lex.ccon}` twice, written +Done (`f22e465`). `what()` twice; `\iref{lex.ccon}` twice, written `encoding\iref{lex.ccon}` with no space before it, as the draft does, since the macro prints its own; `\ref` after "Subclause"; and three sentences the docblocks share with the draft: `\cv{}` before `bool` in two *Constraints*, @@ -508,7 +508,7 @@ added: `bad_expected_access::what()` is routed to `[expected.bad.void]`. Check: item placement is unchanged but for that one, and the synopses gain the paper's 22 group headers. -Done (`65eab56`). 21 banners in the three `expected` classes became group +Done (`081b893`). 21 banners in the three `expected` classes became group comments and `unexpected` gained its one, 22 in all; 56 `\at` markers went, and 16 remain: 14 in `unexpected.hpp`, whose members after the constructors sit outside any group in the draft's synopsis, and the two that place a @@ -742,7 +742,7 @@ header change can clear. - 2026-11-19: specgen 0.44.0 exits 1 on a docblock error (specgen#350), so the run fails today, flag or no flag. On the scratch headers `--validate --warnings-as-errors` exits 0. -- 2026-11-19: the flag is in the makefile's specgen call (`c9d9569`), as +- 2026-11-19: the flag is in the makefile's specgen call (`3882f08`), as recommended, and off the draft diff in `wording-gap`. Applied in carrying out [regenerate](#regenerate); not ruled on. @@ -900,7 +900,7 @@ holds, and lists the files in the depfile. `git archive` of that revision into a scratch directory, since the local checkout sits at N5054. `utilities.tex` does not differ between `3e3793aa` and `65890fab`. -- 2026-11-19: `DRAFT_SOURCE` is the variable (`2a0102d`), read only by +- 2026-11-19: `DRAFT_SOURCE` is the variable (`23188c3`), read only by `wording-gap`, which skips the draft measure when it is unset. Where the revision is recorded is still open.