Skip to content

Commit 1112cfd

Browse files
fixup! [libc++] Remove potential 0-sized array in __compressed_pair_padding
1 parent 55765d0 commit 1112cfd

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

libcxx/include/__memory/compressed_pair.h

+4-8
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
5252

5353
#ifndef _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING
5454

55-
template <class _ToPad,
56-
bool _Empty = ((is_empty<_ToPad>::value && !__libcpp_is_final<_ToPad>::value) ||
57-
is_reference<_ToPad>::value || sizeof(_ToPad) - __datasizeof_v<_ToPad> == 0)>
58-
class __compressed_pair_padding {
59-
char __padding_[sizeof(_ToPad) - __datasizeof_v<_ToPad>];
60-
};
61-
6255
template <class _ToPad>
63-
class __compressed_pair_padding<_ToPad, true> {};
56+
using __compressed_pair_padding =
57+
__padding<((is_empty<_ToPad>::value && !__libcpp_is_final<_ToPad>::value) || is_reference<_ToPad>::value)
58+
? 0
59+
: (sizeof(_ToPad) - __datasizeof_v<_ToPad>)>;
6460

6561
# define _LIBCPP_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \
6662
_LIBCPP_NO_UNIQUE_ADDRESS __attribute__((__aligned__(_LIBCPP_ALIGNOF(T2)))) T1 Initializer1; \

0 commit comments

Comments
 (0)