[clang] [C23] Accept an _Atomic underlying type (PR #147802)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 10 11:06:57 PDT 2025
AaronBallman wrote:
Another concrete reason for why this should default to an error for `_Atomic` is https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0943r6.html
In the C++ version of `stdatomic.h`, there's a `#define _Atomic(x) std::atomic<x>` which exists for shared header files between C and C++. `enum E : std::atomic<int> { Whatever };` is invalid in C++, it would be rather surprising for `enum E : _Atomic(int) { Whatever };` to then be valid in C and invalid in C++. So we error by default, but still allow users to opt out of the error if they find they need to support an `_Atomic` underlying type.
https://github.com/llvm/llvm-project/pull/147802
More information about the cfe-commits
mailing list