[clang] [Headers] Don't declare unreachable() from stddef.h in C++ (PR #86748)

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 29 03:55:54 PDT 2024


philnik777 wrote:

> `unreachable` is morally similar to `offsetof` in that it's a macro interface where the implementation can give better results by expanding to a builtin than a library is likely to be able to give via a naive implementation, but the interfaces _can_ be provided by a CRT.

FWIW I don't think they are morally similar. `unreachable` could be implemented in very different ways. Consider a libc which tries to terminate on UB instead of letting the compiler optimize things away (e.g. a debug mode). Then the Clang implementation is not at all what the libc would do.


https://github.com/llvm/llvm-project/pull/86748


More information about the cfe-commits mailing list