[libcxx-commits] [libcxx] Reapply "[libc++] Optimize vector growing of trivially relocatable types" (PR #80558)

Nico Weber via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 4 15:36:38 PST 2024


nico wrote:

We're seeing compile errors after this, e.g.

```
In file included from ../../cc/metrics/frame_sorter_unittest.cc:5:
In file included from ../../cc/metrics/frame_sorter.h:13:
In file included from ../../base/containers/circular_deque.h:14:
In file included from ../../base/check.h:17:
In file included from ../../base/memory/raw_ptr.h:11:
In file included from ../../base/allocator/partition_allocator/src/partition_alloc/pointers/raw_ptr.h:10:
In file included from ../../third_party/libc++/src/include/functional:526:
In file included from ../../third_party/libc++/src/include/__functional/boyer_moore_searcher.h:22:
In file included from ../../third_party/libc++/src/include/__memory/shared_ptr.h:32:
../../third_party/libc++/src/include/__memory/uninitialized_algorithms.h:646:22: error: cannot initialize a parameter of type 'void *' with an lvalue of type 'const viz::BeginFrameArgs *'
  646 |     __builtin_memcpy(__result, __first, sizeof(_Tp) * (__last - __first));
      |                      ^~~~~~~~
../../third_party/libc++/src/include/vector:993:8: note: in instantiation of function template specialization 'std::__uninitialized_allocator_relocate<std::allocator<const viz::BeginFrameArgs>, const viz::BeginFrameArgs>' requested here
  993 |   std::__uninitialized_allocator_relocate(
      |        ^
../../third_party/libc++/src/include/vector:1472:3: note: in instantiation of member function 'std::vector<const viz::BeginFrameArgs>::__swap_out_circular_buffer' requested here
 1472 |   __swap_out_circular_buffer(__v);
      |   ^
../../third_party/libc++/src/include/vector:1496:13: note: in instantiation of function template specialization 'std::vector<const viz::BeginFrameArgs>::__push_back_slow_path<const viz::BeginFrameArgs>' requested here
 1496 |     __end = __push_back_slow_path(std::move(__x));
      |             ^
../../cc/metrics/frame_sorter_unittest.cc:63:15: note: in instantiation of member function 'std::vector<const viz::BeginFrameArgs>::push_back' requested here
   63 |         args_.push_back(GetNextFrameArgs());
      |               ^
```

(https://source.chromium.org/chromium/chromium/src/+/main:cc/metrics/frame_sorter_unittest.cc;l=63?q=frame_sorter_unittest)

Is this expected?

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


More information about the libcxx-commits mailing list