libstdc++: Fix _GLIBCXX_DEBUG mode constexpr compatibility
authorFrançois Dumont <fdumont@gcc.gnu.org>
Fri, 11 Dec 2020 06:48:06 +0000 (07:48 +0100)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Sat, 12 Dec 2020 17:07:45 +0000 (18:07 +0100)
commit815eb852a2d293331eba2e241a986b8641d4da1f
tree87144b47033444a9bbb696bffbaf43c1d5af1c30
parentff2dfdef2f2e01c579dd280daa1d81fbeb4d7ac5
libstdc++: Fix _GLIBCXX_DEBUG mode constexpr compatibility

The __glibcxx_check_can_[increment|decrement]_range macros are using the
_GLIBCXX_DEBUG_VERIFY_COND_AT macro which is not constexpr compliant and will produce nasty
diagnostics rather than the std::__failed_assertion dedicated to constexpr. Replace it with
correct _GLIBCXX_DEBUG_VERIFY_AT_F.

libstdc++-v3/ChangeLog:

* include/debug/macros.h (__glibcxx_check_can_increment_range): Replace
_GLIBCXX_DEBUG_VERIFY_COND_AT usage with _GLIBCXX_DEBUG_VERIFY_AT_F.
(__glibcxx_check_can_decrement_range): Likewise.
* testsuite/25_algorithms/copy_backward/constexpr.cc (test03): New.
* testsuite/25_algorithms/copy/debug/constexpr_neg.cc: New test.
* testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc: New test.
* testsuite/25_algorithms/equal/constexpr_neg.cc: New test.
* testsuite/25_algorithms/equal/debug/constexpr_neg.cc: New test.
libstdc++-v3/include/debug/macros.h
libstdc++-v3/testsuite/25_algorithms/copy/debug/constexpr_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/25_algorithms/copy_backward/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/25_algorithms/equal/constexpr_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/25_algorithms/equal/debug/constexpr_neg.cc [new file with mode: 0644]