This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

4454. assert should forbid co_await and co_yield

Section: 19.3.3 [assertions.assert] Status: New Submitter: Jonathan Wakely Opened: 2025-11-06 Last modified: 2025-11-06

Priority: 1

View all issues with New 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.

Proposed resolution: