Debug assertion and constexpr

Jonathan Wakely jwakely@redhat.com
Tue Jul 28 13:57:00 GMT 2015


On 27/07/15 21:16 +0200, François Dumont wrote:
>Hello
>
>    There are at the moment several failures in the libstdc++ testsuite
>when run in debug mode (_GLIBCXX_DEBUG). This is so because debug
>assertions are not const expressions. Several debug assertions have been
>removed because of this issue.
>
>    So is there a way to define a function as to be ignored in the
>context of a const expression ? If not could we add one ?

No, there is no way without making non-standard front end changes.

I think we should wait and see if
http://cplusplus.github.io/LWG/lwg-active.html#2234 get resolved, then
we can use __builtin_assert() in constexpr functions. It won't give
us the full Debug Mode assertion powers, so no pretty messages
containing formatted information, but we could still assert.



More information about the Gcc mailing list