[libcxx-commits] [libcxx] [libc++] Don't implement <stdatomic.h> before C++23 (PR #123130)
Ryan Prichard via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jan 15 15:37:05 PST 2025
rprichard wrote:
Yeah, removing the extension from upstream seems OK to me. I suspect the Android toolchain situation around stdatomic.h will continue to be complicated, but maybe we can upgrade enough stuff to C++23 and drop Android's historic extension?
> Another example of valid code that works without the extension and breaks with the extension:
>
> ```c++
> // REQUIRES: c++03 || c++11 || c++14 || c++17 || c++20
>
> struct Foo {
> _Atomic(int) f() const;
> };
>
> #include <stdatomic.h>
>
> _Atomic(int) Foo::f() const; // This declaration would differ from the previous one in C++23
> ```
FWIW, I think this code is accepted by Clang prior to the stdatomic.h extension PR, but not by other compilers. i.e. It's a Clang extension to allow C11-style atomics in a C++ language dialect (as long as `<atomic>` isn't included!).
https://github.com/llvm/llvm-project/pull/123130
More information about the libcxx-commits
mailing list