CppCon 2016 has ended
Back To Schedule
Thursday, September 22 • 3:15pm - 4:15pm
How to test static_assert?

Log in to save this to your schedule, view media, leave feedback and see who's attending!

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.

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.

avatar for Roland Bock

Roland Bock

Principal Software Engineer, PPRO Financial Ltd
From my days at the university, I hold a PHD in physics (although that was in the previous century and seems like a different life by now). Ever since then I have been developing software and/or managing engineering teams. In 2008, I started to learn C++ because I could not believe... Read More →

Thursday September 22, 2016 3:15pm - 4:15pm PDT
Frey (Room 406) Meydenbauer Center