[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 05:48:41 PDT 2024


philnik777 wrote:

> I can see WG21 solving this either by removing `unreachable` from `cstddef` or by requiring `utility` to guard against the macro via implementation magic (personally, I think `utility` should guard against it because of users including `stddef.h` directly) and it would be nice to know which direction the committee is leaning before we get too far into a solution.

I'm not sure whether you mean it, but I'd expect that it's handled like `signbit` and friends - they are functions instead of macros. For libc++ that would simply be `#undef unreachable`,  `#include <__utility/unreachable.h>` and `using std::unreachable`.


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


More information about the cfe-commits mailing list