[libcxx-commits] [libcxx] [libc++][test] Make `deallocate_size.pass.cpp` MSVC-friendly (PR #165162)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 29 08:19:42 PDT 2025


================
@@ -41,12 +42,12 @@ struct test_alloc {
   TEST_CONSTEXPR test_alloc(const test_alloc<U, Sz>&) TEST_NOEXCEPT {}
 
   pointer allocate(size_type n, const void* = nullptr) {
-    allocated_ += static_cast<std::ptrdiff_t>(n);
+    allocated_ += static_cast<std::size_t>(n);
----------------
frederick-vs-ja wrote:

The original implicit conversion could be considered lossy when `size_type` is 64-bit but `size_t` is only 32-bit.

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


More information about the libcxx-commits mailing list