diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -721,24 +721,34 @@ static const size_type __endian_factor = 2; #endif - struct __long +_LIBCPP_PACKED_BYTE_FOR_AIX + struct __long_impl { size_type __is_long_ : 1; size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1; size_type __size_; + char + __padding_[sizeof(pointer) * + ((2 * sizeof(size_type) - 1) / sizeof(pointer) + 1) - + 2 * sizeof(size_type)]; pointer __data_; }; +_LIBCPP_PACKED_BYTE_FOR_AIX_END + struct alignas(size_type) alignas(pointer) __long : __long_impl {}; enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ? (sizeof(__long) - 1)/sizeof(value_type) : 2}; - struct __short +_LIBCPP_PACKED_BYTE_FOR_AIX + struct __short_impl { unsigned char __is_long_ : 1; unsigned char __size_ : 7; char __padding_[sizeof(value_type) - 1]; value_type __data_[__min_cap]; }; +_LIBCPP_PACKED_BYTE_FOR_AIX_END + struct alignas(value_type) __short : __short_impl {}; #endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT