[libcxx-commits] [libcxx] [libc++][string] Remove potential non-trailing 0-length array (PR #105865)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 24 03:28:22 PDT 2024


================
@@ -748,6 +748,41 @@ struct __can_be_converted_to_string_view
 struct __uninitialized_size_tag {};
 struct __init_with_sentinel_tag {};
 
+#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
+template <class _CharT, size_t __min_cap, size_t _Padding = sizeof(_CharT) - 1>
+struct __short_impl {
+  _CharT __data_[__min_cap];
+  unsigned char __padding_[_Padding];
+  unsigned char __size_    : 7;
+  unsigned char __is_long_ : 1;
+};
+
+template <class _CharT, size_t __min_cap>
+struct __short_impl<_CharT, __min_cap, 0> {
+  value_type __data_[__min_cap];
----------------
frederick-vs-ja wrote:

`value_type` is not declared here. It should be `_CharT`.
```suggestion
  _CharT __data_[__min_cap];
```

https://github.com/llvm/llvm-project/pull/105865


More information about the libcxx-commits mailing list