Title
`assert` should forbid `co_await` and `co_yield`
Status
ready
Section
[assertions.assert]
Submitter
Jonathan Wakely

Created on 2025-11-06.00:00:00 last changed 4 days ago

Messages

Date: 2026-03-06.16:58:22

Proposed resolution:

This wording is relative to N5032.

  • Modify [assertions.assert] as indicated:

    -3- If `__VA_ARGS__` does not expand to ana well-formed assignment-expression, the program is ill-formed. If such an assignment-expression is ill-formed when treated as an unevaluated operand ([expr.await], [expr.yield]), the program is ill-formed, no diagnostic required.

  • Date: 2026-03-06.00:00:00

    [ 2026-03-06 LWG telecon; move to Ready ]

    Date: 2026-03-06.00:00:00

    [ 2026-03-06 Tim provides wording ]

    Date: 2025-11-06.00:00:00
    Addresses GB 05-129

    The new implementation of `assert` introduced by P2264R7 might require something like `sizeof(bool(__VA_ARGS__))`. Using something like `assert((co_yield 1, true))` would be ill-formed if the implementation of `assert` uses `sizeof`, because `co_yield` cannot appear in an unevaluated context.

    The specification for `assert` should forbid using any constructs which are not valid in unevaluated contexts, unless we are certain that the new `assert` requirements can be implemented without such tricks using unevaluated contexts. "Ill-formed; no diagnostic required" seems appropriate.

    History
    Date User Action Args
    2026-03-06 16:58:22adminsetmessages: + msg16010
    2026-03-06 16:58:22adminsetstatus: new -> ready
    2026-03-06 15:45:48adminsetmessages: + msg16009
    2026-03-06 15:45:48adminsetmessages: + msg16008
    2025-11-06 00:00:00admincreate