[all-commits] [llvm/llvm-project] 0b1240: [libc++][test] Fix construction and comparison for...

A. Jiang via All-commits all-commits at lists.llvm.org
Wed Aug 5 19:09:15 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b12400bd4f0d772ee013873e7a2180d6c6cc241
      https://github.com/llvm/llvm-project/commit/0b12400bd4f0d772ee013873e7a2180d6c6cc241
  Author: A. Jiang <de34 at live.cn>
  Date:   2026-08-06 (Thu, 06 Aug 2026)

  Changed paths:
    M libcxx/test/support/min_allocator.h
    A libcxx/test/support/test.support/test_allocators.pass.cpp
    M libcxx/test/support/test_allocator.h

  Log Message:
  -----------
  [libc++][test] Fix construction and comparison for testing allocators (#212702)

Previously, there were several issues in the allocators provided by
`min_allocator.h` and `test_allocator.h`.

1. Some allocators did not support heterogenous rebinding construction,
and thus failed to meet the Cpp17Allocator named requirements.
2. Some allocators only had `operator==`. This was fine since C++20 but
not in C++17 where there were no rewritten candidates of `!=`.
3. Many equality operators were non-template and homogeneous. This
caused ambiguity since C++20 due to rewritten candidates.

This patch fixes these issues by
- adding missing constructors,
- adding missing `operator!=` (in pre-C++20 modes), and
- making `operator==` and some `operator!=` templates.

Note that it is intended that `operator==`'s for `test_allocator`
perform seemingly redundant constructions (via `static_cast<const
test_allocator&>(y)`) to avoid behavioral change as possible because
implicit conversion was performed before this patch.

A regression test is added.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list