[libcxx-commits] [PATCH] D58201: Make std::memory_order an enum class (P0439R0)

Jonathan Wakely via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 13 15:07:30 PST 2019


jwakely added inline comments.


================
Comment at: include/atomic:603
+
+#endif
 
----------------
jfb wrote:
> I think you want to keep the old `typedef enum memory_order` before C++20, and only enable the new thing in C++20 and later.
That's what we did for libstdc++.


================
Comment at: include/atomic:932
       _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
-        {__c11_atomic_store(&__a_, __d, __m);}
+        {__c11_atomic_store(&__a_, __d, static_cast<int>(__m));}
     _LIBCPP_INLINE_VISIBILITY
----------------
jfb wrote:
> Hmm this is unfortunate. Can we change the builtins to accept the enum? I guess that would make mixing compiler / stdlib versions harder... So I think what you did here is best.
And we also use casts to `int` in libstdc++. Changing the builtins wouldn't help if somebody used new libstdc++ headers with an old Clang or icc that only accepts ints.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58201/new/

https://reviews.llvm.org/D58201





More information about the libcxx-commits mailing list