[all-commits] [llvm/llvm-project] 7cbf95: [libc++][test] Avoid using `allocator<const T>` (#...

Stephan T. Lavavej via All-commits all-commits at lists.llvm.org
Mon Nov 27 17:19:47 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7cbf9598cc6f207a268599cea636533a5c7b2dbd
      https://github.com/llvm/llvm-project/commit/7cbf9598cc6f207a268599cea636533a5c7b2dbd
  Author: Stephan T. Lavavej <stl at nuwen.net>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M libcxx/test/std/containers/views/mdspan/MinimalElementType.h

  Log Message:
  -----------
  [libc++][test] Avoid using `allocator<const T>` (#73545)

Found while running libc++'s test suite with MSVC's STL.

MSVC's STL rejects `allocator<const T>`. This may or may not be
justified by the current Standardese (it was bogus in the C++03 era),
but it's how we reject usage like `vector<const T>`.

A bunch of `mdspan` tests are failing for us because some centralized
machinery is using `allocator<const T>`. Testing that `mdspan` and its
associated types work properly with `const T` is good and necessary, but
directly allocating `const T` is what's a problem for MSVC's STL. I'd
like to ask for a very targeted change here that preserves all of the
test coverage but changes how `ElementPool` interacts with `allocator`.

This intentionally leaves `ElementPool::get_ptr()` returning `T*`
(pointer-to-possibly-const), so there's no externally visible
difference.




More information about the All-commits mailing list