On Fri, Jul 11, 2025 at 03:12:44PM +0100, Jonathan Wakely wrote:
> The if-consteval branches in std::make_exception_ptr and
> std::exception_ptr_cast use a try-catch block, which gives an error for
> -fno-exceptions. Just make them return a null pointer at compile-time
> when -fno-exceptions is used, because there's no way to get an active
> exception with -fno-exceptions.
> 
> For both functions we have a runtime-only branch that depends on RTTI,
> and a fallback using try-catch which works for runtime and consteval.
> Rearrange both functions to express this logic more clearly.
> 
> Also adjust some formatting and whitespace elsewhere in the file.
> 
> libstdc++-v3/ChangeLog:
> 
>       * libsupc++/exception_ptr.h (make_exception_ptr): Return null
>       for consteval when -fno-exceptions is used.
>       (exception_ptr_cast): Likewise. Allow consteval path to work
>       with -fno-rtti.

LGTM.

        Jakub

Reply via email to