[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
Tue Mar 29 05:15:55 PDT 2022


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

v2: avoid ABI breakage (thanks to tests and @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_;
-        };
+        char __padding[sizeof(value_type) - 1];
+        unsigned char __size_;
     };
 
 #else


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122598.418844.patch
Type: text/x-patch
Size: 896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220329/6f9376de/attachment.bin>


More information about the libcxx-commits mailing list