[libcxx-commits] [PATCH] D122598: [libcxx] avoid using anonymous struct with base classes (fixes gcc-12)

Azat Khuzhin via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 7 07:41:14 PDT 2022


azat updated this revision to Diff 421215.
azat added a comment.

Rebase on top of main


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122598/new/

https://reviews.llvm.org/D122598

Files:
  libcxx/include/string


Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -614,21 +614,6 @@
      !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 @@
     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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122598.421215.patch
Type: text/x-patch
Size: 905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220407/93fd3616/attachment.bin>


More information about the libcxx-commits mailing list