[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 10:26:16 PDT 2024


philnik777 wrote:

> Re: there being observable differences between a header in C vs C++ mode, that's already a thing.
> 
> The definition for `isinf` in math.h is specified to be a macro in C, but specified to be a function in C++. We're already doing `#ifdef __cplusplus` for that (see https://github.com/llvm/llvm-project/blob/main/libc/include/llvm-libc-macros/math-macros.h), and other libc's do similar (see `iszero` in glibc).

That's actually really bad. Both libc++ and libstdc++ assume that these are either not provided at all by the libc or are macros. This will inevitably lead to ambiguous overloads.

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


More information about the cfe-commits mailing list