[clang] [Clang] Fix __is_array returning true for zero-sized arrays (PR #86652)

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 1 07:21:53 PDT 2024


philnik777 wrote:

I'd personally be fine with deprecating it. As I said above, we use it in libc++ for padding inside `string` like
```c++
struct short_string {
  <some data>;
  char padding[sizeof(value_type) - 1];
  <more data>;
};
```
That could be refactored relatively easily as
```c++
template <size_t Size>
struct padding_t {
  char data[Size];
};

template <>
struct padding_t<0> {};

struct short_string {
  <some data>;
  [[no_unique_address]] padding_t<sizeof(value_type) - 1> padding;
  <more data>;
};

```
so I don't think that's a use-case worth keeping the extension for.

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


More information about the cfe-commits mailing list