Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

No, C++20 does not mandate that an expression cannot trap a staticassert. A staticassert statement is a compile-time assertion that generates a compilation error if the assertion fails. If an expression can trap a staticassert, it means that the assertion is evaluated at runtime rather than at compile-time, which defeats the purpose of using staticassert. It is up to the developer to ensure that the static_assert statement is evaluated at compile-time and that it cannot be bypassed during runtime.