Issue 243911
Summary [libc++] Sub optimal layout for size-based vector
Labels libc++
Assignees
Reporter ldionne
    Consider this:

```c++
#include <vector>

struct base {};

template <class T>
struct some_allocator : base {
  // ...
};

struct user_struct {
 std::vector<int, some_allocator<int>> c;
  [[no_unique_address]] some_allocator<int> a;
};
```

With the size-based vector, this results in `user_struct` being 32 bytes instead of 24 bytes (with the pointer layout).

The cause is the same as #154146 and the fix would be the same, i.e. enclose the no-unique-address allocator member of the size-based vector in an anonymous struct.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to