libstdc++: Implement "Safe Integral Comparisons" (P0586R2)
authorJonathan Wakely <jwakely@redhat.com>
Mon, 17 Feb 2020 13:20:57 +0000 (13:20 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 17 Feb 2020 13:20:57 +0000 (13:20 +0000)
commit98cf2c265962e260f2f95617983915c754f446ea
treed6a289228989f60b777a58d6ee657070bc0702f3
parent5e2dae50d2dced9896048e036e2c8bebfc65472c
libstdc++: Implement "Safe Integral Comparisons" (P0586R2)

* include/std/type_traits (__is_standard_integer): New helper trait.
* include/std/utility (cmp_equal, cmp_not_equal, cmp_less, cmp_greater)
(cmp_less_equal, cmp_greater_equal, in_range): Define for C++20.
* include/std/version (__cpp_lib_integer_comparison_functions): Define.
* testsuite/20_util/integer_comparisons/1.cc: New test.
* testsuite/20_util/integer_comparisons/2.cc: New test.
* testsuite/20_util/integer_comparisons/equal.cc: New test.
* testsuite/20_util/integer_comparisons/equal_neg.cc: New test.
* testsuite/20_util/integer_comparisons/greater_equal.cc: New test.
* testsuite/20_util/integer_comparisons/greater_equal_neg.cc: New test.
* testsuite/20_util/integer_comparisons/greater_neg.cc: New test.
* testsuite/20_util/integer_comparisons/in_range.cc: New test.
* testsuite/20_util/integer_comparisons/in_range_neg.cc: New test.
* testsuite/20_util/integer_comparisons/less.cc: New test.
* testsuite/20_util/integer_comparisons/less_equal.cc: New test.
* testsuite/20_util/integer_comparisons/less_equal_neg.cc: New test.
* testsuite/20_util/integer_comparisons/less_neg.cc: New test.
* testsuite/20_util/integer_comparisons/not_equal.cc: New test.
* testsuite/20_util/integer_comparisons/not_equal_neg.cc: New test.
19 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/type_traits
libstdc++-v3/include/std/utility
libstdc++-v3/include/std/version
libstdc++-v3/testsuite/20_util/integer_comparisons/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/equal_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/greater_equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/greater_equal_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/greater_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/in_range.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/in_range_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/less.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/less_equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/less_equal_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/less_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/not_equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/integer_comparisons/not_equal_neg.cc [new file with mode: 0644]