How to remove the default "error: static assertion failed:" and print only my message in static_assert?

6.5k views Asked by At

Whenever assertion fails in a code like:

static_assert(std::get<0>(tup1) == 0, "Expected value of 0 is not there");

I would like my program to print only the diagnostic Expected value of 0 is not there instead of error: static assertion failed: Expected value of 0 is not there. How to accomplish this?

1

There are 1 answers

0
LWimsey On BEST ANSWER

This is a compiler generated error message that provides some additional context to why the code could not be compiled. It cannot be changed without changing the compiler sources (but don't do that).