[libcxx-commits] [libcxx] c3d0205 - [libc++] Avoid using anonymous struct with base classes (fixes GCC 12)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Apr 8 13:15:10 PDT 2022
Author: Azat Khuzhin
Date: 2022-04-08T16:14:44-04:00
New Revision: c3d0205ee771edbee287b389699eab70b3670ecf
URL: https://github.com/llvm/llvm-project/commit/c3d0205ee771edbee287b389699eab70b3670ecf
DIFF: https://github.com/llvm/llvm-project/commit/c3d0205ee771edbee287b389699eab70b3670ecf.diff
LOG: [libc++] Avoid using anonymous struct with base classes (fixes GCC 12)
GCC 12 reports:
libcxx/include/string:727:13: error: anonymous struct with base classes
727 | : __padding<value_type>
Differential Revision: https://reviews.llvm.org/D122598
Added:
Modified:
libcxx/include/string
Removed:
################################################################################
diff --git a/libcxx/include/string b/libcxx/include/string
index 60b40c369b691..a0056745f5490 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -614,21 +614,6 @@ struct __can_be_converted_to_string_view : public _BoolConstant<
!is_convertible<const _Tp&, const _CharT*>::value
> {};
-#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
-
-template <class _CharT, size_t = sizeof(_CharT)>
-struct __padding
-{
- unsigned char __xx[sizeof(_CharT)-1];
-};
-
-template <class _CharT>
-struct __padding<_CharT, 1>
-{
-};
-
-#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
-
#ifndef _LIBCPP_HAS_NO_CHAR8_T
typedef basic_string<char8_t> u8string;
#endif
@@ -702,11 +687,8 @@ private:
struct __short
{
value_type __data_[__min_cap];
- struct
- : __padding<value_type>
- {
- unsigned char __size_;
- };
+ unsigned char __padding[sizeof(value_type) - 1];
+ unsigned char __size_;
};
#else
More information about the libcxx-commits
mailing list