diff --git a/libcxx/include/string b/libcxx/include/string index c3a0bcdb630b6a..aba79a74912f5e 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -859,6 +859,13 @@ private: enum { __min_cap = (sizeof(__long) - 1) / sizeof(value_type) > 2 ? (sizeof(__long) - 1) / sizeof(value_type) : 2 }; + struct __short { + value_type __data_[__min_cap]; + _LIBCPP_NO_UNIQUE_ADDRESS __padding __padding_; + unsigned char __size_ : 7; + unsigned char __is_long_ : 1; + }; + // The __endian_factor is required because the field we use to store the size // has one fewer bit than it would if it were not a bitfield. // @@ -901,16 +908,6 @@ private: enum { __min_cap = (sizeof(__long) - 1) / sizeof(value_type) > 2 ? (sizeof(__long) - 1) / sizeof(value_type) : 2 }; -#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT - -#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT - struct __short { - value_type __data_[__min_cap]; - _LIBCPP_NO_UNIQUE_ADDRESS __padding __padding_; - unsigned char __size_ : 7; - unsigned char __is_long_ : 1; - }; -#else struct __short { struct _LIBCPP_PACKED { unsigned char __is_long_ : 1; @@ -919,7 +916,9 @@ private: _LIBCPP_NO_UNIQUE_ADDRESS __padding __padding_; value_type __data_[__min_cap]; }; -#endif + +#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT + static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size."); union __rep {