libstdc++: Fix incorrect test for std::error_code comparisons
authorJonathan Wakely <jwakely@redhat.com>
Wed, 3 Feb 2021 15:49:36 +0000 (15:49 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 3 Feb 2021 15:49:36 +0000 (15:49 +0000)
commita6f08be383f846a0474ea8d1da9222b802c36c7c
tree0df98b891b4534e0e51f4bb5f8082c8cff260df6
parent598876574184e745defee4b36dc2408068b7a22e
libstdc++: Fix incorrect test for std::error_code comparisons

The tests for std::error_code comparisons assumed that a default
constructed object uses std::generic_category(). That's true for a
default constructed std::error_condition, but not std::error_code.

Fix the three-way comparisons to correctly depend on the result of
comparing the categories, and add another test for comparing two objects
with the same category and different values.

libstdc++-v3/ChangeLog:

* testsuite/19_diagnostics/error_code/operators/not_equal.cc:
Add comparison with same category and different values.
* testsuite/19_diagnostics/error_code/operators/less.cc:
Likewise. Fix comparison involving different categories.
* testsuite/19_diagnostics/error_code/operators/three_way.cc:
Likewise.
* testsuite/19_diagnostics/error_condition/operators/less.cc:
Add comment.
* testsuite/19_diagnostics/error_condition/operators/three_way.cc:
Likewise.
libstdc++-v3/testsuite/19_diagnostics/error_code/operators/less.cc
libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc
libstdc++-v3/testsuite/19_diagnostics/error_code/operators/three_way.cc
libstdc++-v3/testsuite/19_diagnostics/error_condition/operators/less.cc
libstdc++-v3/testsuite/19_diagnostics/error_condition/operators/three_way.cc