El 25/10/2026 a las 13:52, Jonathan Grant via Boost escribió:
Hello
I'd like to introduce my P4021 - compile_assert, compile-time diagnostics for expressions that can be proven at compile time. ie they are not const, constexpr, consteval.
https://isocpp.org/files/papers/P4021R2.pdf
There's a github repo with a testsuite, showing lots of simple examples. It's a useful tool to detect issues at compile time, like nullptr dereferences, divide by zero, array subscript errors.
It diagnoses invariants that are proven false, as well as invariants that are not-proven. Helps make software more robust. Handy for Functional Safety. It does this by identifying code that is reachable, but should not be.
Could something like this be added to Boost?
I also hope tools like Claude could utilise compile_assert() to evaluate open source software.
Regards Jonathan
Hi Julien, How was your paper received in WG14? If I understand this correctly, we are relying on compiler's ability to prove the assertion, so I guess that when some limits are passed the compiler won't be able to prove it and the code won't compiler? Best, Ion