constexpr expansion (C++20)
Virtual calls, try/catch, dynamic_cast, union member changes, allocation and trivial default init in constant expressions; consteval, constinit, is_constant_evaluated.
Connected features
Papers
12 · Rapperswil 2018 → Prague 2020Allows virtual function calls in constant expressions.
Adds std::is_constant_evaluated().
Allows try/catch in constexpr functions.
Adds consteval immediate functions.
Allows dynamic_cast and polymorphic typeid in constant expressions.
Allows changing the active member of a union in constant evaluation.
Allows new/delete and std::allocator in constant evaluation, enabling constexpr containers.
Adds constinit.
Permits trivial default initialization in constexpr contexts.
Adjusts the constexpr feature-test macro concerns.
Permits unevaluated inline assembly in constexpr functions.
Fixes inconsistencies between constexpr and consteval functions.