On Fri, 13 Nov 2026 at 22:51, Jason Merrill <[email protected]> wrote:
>
> Tested x86_64-pc-linux-gnu.
>
> I assume you don't want to condition this on only __cpp_contracts as in the
> current patch.  And I don't know how you want to handle the view_interface
> empty() issue.  But I think the rest of the patch could go in as is.  
> Thoughts?

> diff --git a/libstdc++-v3/include/bits/c++config 
> b/libstdc++-v3/include/bits/c++config
> index 0c2407ccd07..fa219b33690 100644
> --- a/libstdc++-v3/include/bits/c++config
> +++ b/libstdc++-v3/include/bits/c++config
> @@ -642,15 +642,26 @@ namespace std
>  #if defined(_GLIBCXX_ASSERTIONS)
>  // When _GLIBCXX_ASSERTIONS is defined we enable runtime assertion checks.
>  // These checks will also be done during constant evaluation.
> +# if __cpp_contracts
> +#  define __glibcxx_assert(cond) __contract_assert(cond)
> +# else
>  # define __glibcxx_assert(cond)                                              
>   \
>    do {                                                                 \
>      if (__builtin_expect(!bool(cond), false))                          \
>        _GLIBCXX_ASSERT_FAIL(cond);                                      \
>    } while (false)
> +# endif

This seems problematic. If I pass
-fcontract-evaluation-semantic=observe/ignore, that turns the
libstdc++ hardening off.

If I want to observe/ignore the program's own contracts, but keep
libstdc++ hardening on, I can't do that.

Reply via email to