This slightly improve the readability of error message, by suggesting
that 0 (literal) is expected as argument:
  invalid conversion from 'int' to 'std::__cmp_cat::__literal_zero*'

libstdc++-v3/ChangeLog:

        * libsupc++/compare (__cmp_cat::__literal_zero): Rename
        from __unspec.
        (__cmp_cat::__unspec): Rename to __literal_zero.
        (operator==, operator<, operator>, operator<=, operator>=):
        Replace __cmp_cat::__unspec to __cmp_cat::__literal_zero.
---
v2:
* renames __zero_literal to __literal_zero
* removes the test, that was merged separately

As before, the improvement from the name is slight, and very subjective,
so would be interested in other people opinion.


 libstdc++-v3/libsupc++/compare | 70 +++++++++++++++++-----------------
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare
index ca7c9095c3c..e956275042b 100644
--- a/libstdc++-v3/libsupc++/compare
+++ b/libstdc++-v3/libsupc++/compare
@@ -73,9 +73,9 @@ namespace std _GLIBCXX_VISIBILITY(default)
       __make(_Ord __o) noexcept
       { return _Ordering(__o); }
 
-    struct __unspec
+    struct __zero_literal
     {
-      consteval __unspec(__unspec*) noexcept { }
+      consteval __zero_literal(__zero_literal*) noexcept { }
     };
   }
 
@@ -112,7 +112,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
     // comparisons
     [[nodiscard]]
     friend constexpr bool
-    operator==(partial_ordering __v, __cmp_cat::__unspec) noexcept
+    operator==(partial_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value == 0; }
 
     [[nodiscard]]
@@ -121,52 +121,52 @@ namespace std _GLIBCXX_VISIBILITY(default)
 
     [[nodiscard]]
     friend constexpr bool
-    operator< (partial_ordering __v, __cmp_cat::__unspec) noexcept
+    operator< (partial_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value == -1; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator> (partial_ordering __v, __cmp_cat::__unspec) noexcept
+    operator> (partial_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value == 1; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator<=(partial_ordering __v, __cmp_cat::__unspec) noexcept
+    operator<=(partial_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_reverse() >= 0; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator>=(partial_ordering __v, __cmp_cat::__unspec) noexcept
+    operator>=(partial_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value >= 0; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator< (__cmp_cat::__unspec, partial_ordering __v) noexcept
+    operator< (__cmp_cat::__zero_literal, partial_ordering __v) noexcept
     { return __v._M_value == 1; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator> (__cmp_cat::__unspec, partial_ordering __v) noexcept
+    operator> (__cmp_cat::__zero_literal, partial_ordering __v) noexcept
     { return __v._M_value == -1; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator<=(__cmp_cat::__unspec, partial_ordering __v) noexcept
+    operator<=(__cmp_cat::__zero_literal, partial_ordering __v) noexcept
     { return 0 <= __v._M_value; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator>=(__cmp_cat::__unspec, partial_ordering __v) noexcept
+    operator>=(__cmp_cat::__zero_literal, partial_ordering __v) noexcept
     { return 0 <= __v._M_reverse(); }
 
     [[nodiscard]]
     friend constexpr partial_ordering
-    operator<=>(partial_ordering __v, __cmp_cat::__unspec) noexcept
+    operator<=>(partial_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v; }
 
     [[nodiscard]]
     friend constexpr partial_ordering
-    operator<=>(__cmp_cat::__unspec, partial_ordering __v) noexcept
+    operator<=>(__cmp_cat::__zero_literal, partial_ordering __v) noexcept
     { return partial_ordering(__cmp_cat::_Ord(__v._M_reverse())); }
   };
 
@@ -209,7 +209,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
     // comparisons
     [[nodiscard]]
     friend constexpr bool
-    operator==(weak_ordering __v, __cmp_cat::__unspec) noexcept
+    operator==(weak_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value == 0; }
 
     [[nodiscard]]
@@ -218,52 +218,52 @@ namespace std _GLIBCXX_VISIBILITY(default)
 
     [[nodiscard]]
     friend constexpr bool
-    operator< (weak_ordering __v, __cmp_cat::__unspec) noexcept
+    operator< (weak_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value < 0; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator> (weak_ordering __v, __cmp_cat::__unspec) noexcept
+    operator> (weak_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value > 0; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator<=(weak_ordering __v, __cmp_cat::__unspec) noexcept
+    operator<=(weak_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value <= 0; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator>=(weak_ordering __v, __cmp_cat::__unspec) noexcept
+    operator>=(weak_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value >= 0; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator< (__cmp_cat::__unspec, weak_ordering __v) noexcept
+    operator< (__cmp_cat::__zero_literal, weak_ordering __v) noexcept
     { return 0 < __v._M_value; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator> (__cmp_cat::__unspec, weak_ordering __v) noexcept
+    operator> (__cmp_cat::__zero_literal, weak_ordering __v) noexcept
     { return 0 > __v._M_value; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator<=(__cmp_cat::__unspec, weak_ordering __v) noexcept
+    operator<=(__cmp_cat::__zero_literal, weak_ordering __v) noexcept
     { return 0 <= __v._M_value; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator>=(__cmp_cat::__unspec, weak_ordering __v) noexcept
+    operator>=(__cmp_cat::__zero_literal, weak_ordering __v) noexcept
     { return 0 >= __v._M_value; }
 
     [[nodiscard]]
     friend constexpr weak_ordering
-    operator<=>(weak_ordering __v, __cmp_cat::__unspec) noexcept
+    operator<=>(weak_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v; }
 
     [[nodiscard]]
     friend constexpr weak_ordering
-    operator<=>(__cmp_cat::__unspec, weak_ordering __v) noexcept
+    operator<=>(__cmp_cat::__zero_literal, weak_ordering __v) noexcept
     { return weak_ordering(__cmp_cat::_Ord(-__v._M_value)); }
   };
 
@@ -309,7 +309,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
     // comparisons
     [[nodiscard]]
     friend constexpr bool
-    operator==(strong_ordering __v, __cmp_cat::__unspec) noexcept
+    operator==(strong_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value == 0; }
 
     [[nodiscard]]
@@ -318,52 +318,52 @@ namespace std _GLIBCXX_VISIBILITY(default)
 
     [[nodiscard]]
     friend constexpr bool
-    operator< (strong_ordering __v, __cmp_cat::__unspec) noexcept
+    operator< (strong_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value < 0; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator> (strong_ordering __v, __cmp_cat::__unspec) noexcept
+    operator> (strong_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value > 0; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator<=(strong_ordering __v, __cmp_cat::__unspec) noexcept
+    operator<=(strong_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value <= 0; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator>=(strong_ordering __v, __cmp_cat::__unspec) noexcept
+    operator>=(strong_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v._M_value >= 0; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator< (__cmp_cat::__unspec, strong_ordering __v) noexcept
+    operator< (__cmp_cat::__zero_literal, strong_ordering __v) noexcept
     { return 0 < __v._M_value; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator> (__cmp_cat::__unspec, strong_ordering __v) noexcept
+    operator> (__cmp_cat::__zero_literal, strong_ordering __v) noexcept
     { return 0 > __v._M_value; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator<=(__cmp_cat::__unspec, strong_ordering __v) noexcept
+    operator<=(__cmp_cat::__zero_literal, strong_ordering __v) noexcept
     { return 0 <= __v._M_value; }
 
     [[nodiscard]]
     friend constexpr bool
-    operator>=(__cmp_cat::__unspec, strong_ordering __v) noexcept
+    operator>=(__cmp_cat::__zero_literal, strong_ordering __v) noexcept
     { return 0 >= __v._M_value; }
 
     [[nodiscard]]
     friend constexpr strong_ordering
-    operator<=>(strong_ordering __v, __cmp_cat::__unspec) noexcept
+    operator<=>(strong_ordering __v, __cmp_cat::__zero_literal) noexcept
     { return __v; }
 
     [[nodiscard]]
     friend constexpr strong_ordering
-    operator<=>(__cmp_cat::__unspec, strong_ordering __v) noexcept
+    operator<=>(__cmp_cat::__zero_literal, strong_ordering __v) noexcept
     { return strong_ordering(__cmp_cat::_Ord(-__v._M_value)); }
   };
 
-- 
2.50.1

Reply via email to