How to test static_assert?

This talk will demonstrate several options for testing static_assert, ranging from the build system, over the compiler features to template meta programming. It will include real-life examples from sqlpp11.

static_assert gives us the ability to assert conditions at compile time and provide custom error messages in case the conditions are not met. Cool! But how can you be sure that your precious static_asserts actually fire when you need them? There is only one way to know for sure: You need to test your static_assert! That is easier said than done, though, as static_assert produces a hard, unrecoverable compile-time error. For instance, you cannot test one static_assert with another.

Video producer:

Related Videos: