From be45fe5d8508b9e6988849ead6471aaad68405e5 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Sat, 10 Jun 2023 12:44:03 +0300 Subject: [PATCH] [libc++][spaceship] P1614R2: Removed ops from `complex` Implements parts of P1614R2: - Removed ops from `complex` Reviewed By: #libc, Mordante Differential Revision: https://reviews.llvm.org/D152615 --- libcxx/docs/Status/SpaceshipProjects.csv | 2 +- libcxx/include/complex | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/libcxx/docs/Status/SpaceshipProjects.csv b/libcxx/docs/Status/SpaceshipProjects.csv index 214ab8b..ddb2d98 100644 --- a/libcxx/docs/Status/SpaceshipProjects.csv +++ b/libcxx/docs/Status/SpaceshipProjects.csv @@ -137,7 +137,7 @@ Section,Description,Dependencies,Assignee,Complete | `[alg.three.way] `_",| `lexicographical_compare_three_way `_,[comparisons.three.way],Adrian Vogelsgesang,|Complete| - `5.11 Clause 26: Numerics library `_,,,, "| `[complex.syn] `_ -| `[complex.ops] `_",| remove ops `complex `_,None,Hristo Hristov,|In Progress| +| `[complex.ops] `_",| remove ops `complex `_,None,Hristo Hristov,|Complete| "| `[class.slice.overview] `_ | `[slice.ops] `_",| `slice `_,None,Hristo Hristov,|Complete| - `5.12 Clause 27: Time library `_,,,, diff --git a/libcxx/include/complex b/libcxx/include/complex index 26f189d..d12cfa9 100644 --- a/libcxx/include/complex +++ b/libcxx/include/complex @@ -148,12 +148,12 @@ template complex operator/(const complex&, const T&); // template complex operator/(const T&, const complex&); // constexpr in C++20 template complex operator+(const complex&); // constexpr in C++20 template complex operator-(const complex&); // constexpr in C++20 -template bool operator==(const complex&, const complex&); // constexpr in C++14 -template bool operator==(const complex&, const T&); // constexpr in C++14 -template bool operator==(const T&, const complex&); // constexpr in C++14 -template bool operator!=(const complex&, const complex&); // constexpr in C++14 -template bool operator!=(const complex&, const T&); // constexpr in C++14 -template bool operator!=(const T&, const complex&); // constexpr in C++14 +template bool operator==(const complex&, const complex&); // constexpr in C++14 +template bool operator==(const complex&, const T&); // constexpr in C++14 +template bool operator==(const T&, const complex&); // constexpr in C++14, removed in C++20 +template bool operator!=(const complex&, const complex&); // constexpr in C++14, removed in C++20 +template bool operator!=(const complex&, const T&); // constexpr in C++14, removed in C++20 +template bool operator!=(const T&, const complex&); // constexpr in C++14, removed in C++20 template basic_istream& @@ -827,6 +827,8 @@ operator==(const complex<_Tp>& __x, const _Tp& __y) return __x.real() == __y && __x.imag() == 0; } +#if _LIBCPP_STD_VER <= 17 + template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 bool @@ -859,6 +861,8 @@ operator!=(const _Tp& __x, const complex<_Tp>& __y) return !(__x == __y); } +#endif + // 26.3.7 values: template ::value, -- 2.7.4