https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93161

            Bug ID: 93161
           Summary: Remove extra operator== for comparison categories in
                    <compare> not in standard
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wezrule at hotmail dot com
  Target Milestone: ---

The following compiles fine with gcc (on godbolt gcc trunk):

int x{2};
int y{2};
auto s = x <=> y;
s == std::strong_ordering::equal; // fails with MSVC
https://godbolt.org/z/baRNF6

However the last line fails to compile with MSVC. After checking the standards
library support document operator==(strong_ordering, strong_ordering) is not
mentioned:
http://wg21.link/p0768

On the gcc master branch it can be located here (same exists for weak_ordering
and other comparison categories):
https://github.com/wezrule/gcc/blob/master/libstdc%2B%2B-v3/libsupc%2B%2B/compare#L299

Even worse is that value types are not even standardised for comparison
operators! (thanks Bo Persson):
http://wg21.link/P1946

I think these should just be removed, it's recommended to compare against 0 and
would be good to not have further inconsistencies in implementations.

Cheers,
Wesley

Reply via email to