[libcxx-commits] [libcxx] [libc++] Make `_Atomic(T)` directly use an alias template (PR #168679)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 20 22:28:24 PST 2025


frederick-vs-ja wrote:

> > > Then it should be mentioned in the wording IMO. as-is it's not at all clear what the intention is - and at least two out of three implementation have done the obvious thing. AFAICT this effect was never intended.
> > 
> > 
> > I'm sure that it was intended to use something other than plain `std::atomic<T>`, as this was the changed part between [P0943R5](http://wg21.link/p0943r5) and [P0943R6](http://wg21.link/p0943r6). But the motivation is not clear to me. It's possibly related to:
> 
> According to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122738#c2 it's to avoid a dependency on `<atomic>`, however that's supposed to work.

I've checked that we can avoid including the whole `<atomic>` in `<stdatomic.h>`, although this doesn't seem to save compilation time a lot. Do you think it's worth doing this? However, it seems unavoidable to expose `std::atomic`, unless we seal it into a module.

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


More information about the libcxx-commits mailing list