P3100R3 — Implicit contract assertions
Timur Doumler, Joshua Berne
EWG
Revisions R8Aug 2026R7Jul 2026R6May 2026R3Jul 2025
In this paper, we enumerate all cases of core language undefined behaviour explicitly specified in C++, group them into eleven categories, classify them along a number of relevant criteria, and discuss appropriate mitigation strategies. The conditions under which such undefined behaviour will occur can, in many cases, be identified by a runtime check. We describe how such runtime checks can be systematically introduced via *implicit* *contract* *assertions*, giving users complete control over what impact that undefined behaviour has on their programs. In addition to runtime checking, we introduce well-defined fallback behaviour to replace undefined behaviour wherever possible. Building on Contracts as adopted for C++26, we provide a generic framework that can be incorporated into the ongoing core language UB white paper [P3656R1], fundamentally changing the landscape of how undefined behaviour is approached in C++.