[libcxx-commits] [libcxx] [libc++] Remove potential 0-sized array in __compressed_pair_padding (PR #109028)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 18 09:02:23 PDT 2024


================
@@ -52,13 +52,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 #ifndef _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING
 
-template <class _ToPad>
+template <class _ToPad,
+          bool _Empty = ((is_empty<_ToPad>::value && !__libcpp_is_final<_ToPad>::value) ||
+                         is_reference<_ToPad>::value || sizeof(_ToPad) - __datasizeof_v<_ToPad> == 0)>
 class __compressed_pair_padding {
-  char __padding_[((is_empty<_ToPad>::value && !__libcpp_is_final<_ToPad>::value) || is_reference<_ToPad>::value)
-                      ? 0
-                      : sizeof(_ToPad) - __datasizeof_v<_ToPad>];
+  char __padding_[sizeof(_ToPad) - __datasizeof_v<_ToPad>];
----------------
serge-sans-paille wrote:

indeed

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


More information about the libcxx-commits mailing list