C++26 introduces several changes that reduce or eliminate undefined behaviour in C++ programs. On the language side: deleting a pointer to an incomplete type is now ill-formed (a compile error), reading uninitialized variables becomes 'erroneous behaviour' rather than UB (with the new [[indeterminate]] attribute for opt-in UB), and returning a reference bound to a temporary is now a compile error. On the library side, P3471R4 standardizes runtime precondition checking (hardening) for containers, views, and wrappers like std::vector, std::span, and std::optional, with roughly 0.3% performance overhead when enabled via -fhardened. Most of these improvements require only recompilation with a C++26-conforming compiler.
Table of contents
P3144R2: Deleting a Pointer to an Incomplete Type Should be Ill-formedP2795R5: Erroneous Behaviour for Uninitialized ReadsP2748R5: Disallow Binding a Returned Reference to a TemporaryP3471R4: Standard Library HardeningConclusionConnect deeper338 Impressions