[libcxx-commits] [libcxx] [libc++] Fix bitset conversion functions and refactor constructor (PR #121348)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 13 08:58:44 PDT 2025


================
@@ -220,11 +225,51 @@ protected:
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator^=(const __bitset& __v) _NOEXCEPT;
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void flip() _NOEXCEPT;
+
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unsigned long __to_ulong() const {
+    static_assert(sizeof(__storage_type) >= sizeof(unsigned long),
+                  "bitset only supports platforms where sizeof(size_t) >= sizeof(unsigned long), such as 32-bit and "
+                  "64-bit platforms");
----------------
philnik777 wrote:

```suggestion
                  "libc++ only supports platforms where sizeof(size_t) >= sizeof(unsigned long), such as 32-bit and "
                  "64-bit platforms. If you're interested in supporting a platform where that is not the case, please contact the libc++ developers.");
```
Otherwise people might think that we have no interest in supporting their platform.

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


More information about the libcxx-commits mailing list