[libcxx-commits] [libcxx] [libc++][optional] LWG4497: `std::nullopt_t` should be comparable (PR #214975)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Aug 8 08:25:44 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- libcxx/test/std/utilities/optional/optional.nullopt/compare.three_way.pass.cpp libcxx/include/__optional/nullopt_t.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/std/utilities/optional/optional.nullopt/compare.three_way.pass.cpp b/libcxx/test/std/utilities/optional/optional.nullopt/compare.three_way.pass.cpp
index c0d17e809..499716b7c 100644
--- a/libcxx/test/std/utilities/optional/optional.nullopt/compare.three_way.pass.cpp
+++ b/libcxx/test/std/utilities/optional/optional.nullopt/compare.three_way.pass.cpp
@@ -24,22 +24,21 @@
#include "test_macros.h"
-
#if TEST_STD_VER >= 20
static_assert(std::copyable<std::nullopt_t>);
static_assert(std::three_way_comparable<std::nullopt_t, std::strong_ordering>);
#endif
constexpr bool test() {
- assert(std::nullopt == std:nullopt);
- assert(!(std:nullopt != std:nullopt));
- assert(std:nullopt <= std:nullopt);
- assert(std:nullopt >= std:nullopt);
- assert(!(std:nullopt > std:nullopt));
- assert(!(std:nullopt < std:nullopt));
+ assert(std::nullopt == std : nullopt);
+ assert(!(std : nullopt != std : nullopt));
+ assert(std : nullopt <= std : nullopt);
+ assert(std : nullopt >= std : nullopt);
+ assert(!(std : nullopt > std : nullopt));
+ assert(!(std : nullopt < std : nullopt));
#if TEST_STD_VER >= 20
- assert((std:nullopt <=> std:nullopt) == std::strong_ordering::equal);
+ assert((std : nullopt <=> std : nullopt) == std::strong_ordering::equal);
// Test ranges::find with nullopt
std::vector<std::optional<int>> v = {1, 2, nullopt, 4, 5};
auto it = std::ranges::find(v, nullopt);
``````````
</details>
https://github.com/llvm/llvm-project/pull/214975
More information about the libcxx-commits
mailing list