[all-commits] [llvm/llvm-project] d34720: [libc++][test] Test SFINAE for `optional`'s operat...

A. Jiang via All-commits all-commits at lists.llvm.org
Mon Sep 7 22:32:58 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d34720a9ca4492dbb65af8b652e60dbb5f60ca55
      https://github.com/llvm/llvm-project/commit/d34720a9ca4492dbb65af8b652e60dbb5f60ca55
  Author: A. Jiang <de34 at live.cn>
  Date:   2026-09-08 (Tue, 08 Sep 2026)

  Changed paths:
    M libcxx/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp
    M libcxx/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp
    M libcxx/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp
    M libcxx/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp
    M libcxx/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp
    M libcxx/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp
    M libcxx/test/std/utilities/optional/optional.relops/equal.pass.cpp
    M libcxx/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp
    M libcxx/test/std/utilities/optional/optional.relops/greater_than.pass.cpp
    M libcxx/test/std/utilities/optional/optional.relops/less_equal.pass.cpp
    M libcxx/test/std/utilities/optional/optional.relops/less_than.pass.cpp
    M libcxx/test/std/utilities/optional/optional.relops/not_equal.pass.cpp
    M libcxx/test/support/test_comparisons.h

  Log Message:
  -----------
  [libc++][test] Test SFINAE for `optional`'s operators in C++17 (#221643)

We have been intentionally constraining `optional`'s comparison
operators since C++17, so it is probably better to test the constraints
in C++17 mode. Given the constraints are standardized only since C++26
(via P2944R3), `LIBCPP_STATIC_ASSERT` is used in old modes.

In order to do this, `test_comparisons.h` is reworked to expose
`NonComparable` and `EqualityComparable` in pre-C++20 modes, and a new
type `TotallyOrdered` is invented as a replacement of
`ThreeWayComparable` in old modes.

As drive-by, also switches to use `// REQUIRES: std-at-least-c++17` in
touched test files, and adds previously missed includes of
`<type_traits>`.



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