[PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

Xi Ruoyao xry111@mengyan1223.wang
Thu Mar 31 15:59:26 GMT 2022

On Thu, 2022-03-31 at 17:50 +0200, Matthias Kretz via Gcc-patches wrote:
> I like it. But I'd like it even more if we could have
> #elif defined _UBSAN
>     __ubsan_invoke_ub("reached std::unreachable()");
> But to my knowledge UBSAN has no hooks for the library like this
> (yet).

UBSAN can catch __builtin_unreachable() and print a message "execution
reached an unreachable program point".
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University

More information about the Libstdc++ mailing list