This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Ready status.
assert should forbid co_await and co_yieldSection: 19.3.3 [assertions.assert] Status: Ready Submitter: Jonathan Wakely Opened: 2025-11-06 Last modified: 2026-03-06
Priority: 1
View all issues with Ready status.
Discussion:
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.
[2026-03-06 Tim provides wording]
[2026-03-06 LWG telecon; move to Ready]
Proposed resolution:
This wording is relative to N5032.
Modify 19.3.3 [assertions.assert] as indicated:
-3- If
__VA_ARGS__does not expand toana well-formed assignment-expression, the program is ill-formed. If such an assignment-expression is ill-formed when treated as an unevaluated operand (7.6.2.4 [expr.await], 7.6.17 [expr.yield]), the program is ill-formed, no diagnostic required.