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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 8 13:15:16 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc3d0205ee771: [libc++] Avoid using anonymous struct with base classes (fixes GCC 12) (authored by azat, committed by ldionne).

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.421626.patch
Type: text/x-patch
Size: 905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220408/2fca3879/attachment.bin>


More information about the libcxx-commits mailing list