On 28/09/19 23:12 +0200, François Dumont wrote:
Here is what I just commited.
I try to use the asm trick in the _GLIBCXX_DEBUG_VERIFY_COND_AT but
didn't notice any enhancement. So for now I kept my solution to just
have a non-constexpr call compiler error.
I fix my patch to use __builtin_is_constant_evaluated rather than
std::is_constant_evaluated in __valid_range.
* include/bits/stl_algobase.h (__memmove): Return _Tp*.
(__memmove): Loop as long as __n is not 0.
(__copy_move<>::__copy_m): Likewise.
(__copy_move_backward<>::__copy_move_b): Likewise.
* testsuite/25_algorithms/copy/constexpr.cc: Add check on copied
values.
* testsuite/25_algorithms/copy_backward/constexpr.cc: Likewise.
* testsuite/25_algorithms/copy/constexpr_neg.cc: New.
* testsuite/25_algorithms/copy_backward/constexpr.cc: New.
* include/debug/forward_list
(_Sequence_traits<__debug::forward_list<>>::_S_size): Returns __dp_sign
distance when not empty.
* include/debug/list
(_Sequence_traits<__debug::list<>>::_S_size): Likewise.
* include/debug/helper_functions.h (__dp_sign_max_size): New
_Distance_precision enum entry.
* include/debug/safe_iterator.h
(__copy_move_a(_II, _II, const _Safe_iterator<>&)): Check for output
iterator _M_can_advance as soon as input range distance precision is
strictly higher than __dp_size.
(__copy_move_a(const _Safe_iterator<>&, const _Safe_iterator<>&,
const _Safe_iterator<>&)): Likewise.
(__copy_move_backward_a(_II, _II, const _Safe_iterator<>&)): Likewise.
(__copy_move_backward_a(const _Safe_iterator<>&,
const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
(__equal_aux(_II, _II, const _Safe_iterator<>&)): Likewise.
(__equal_aux(const _Safe_iterator<>&,
const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
I'm going to commit this small fix.
commit d78a141b86aca5a1265ec2df96428ef387492a1f
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Wed Oct 23 16:19:28 2019 +0100
Only qualify function as constexpr for C++14 and later
This helper function is not a valid constexpr function in C++11, so
should only be marked constexpr for C++14 and later.
* include/debug/helper_functions.h (__valid_range): Change
_GLIBCXX_CONSTEXPR to _GLIBCXX14_CONSTEXPR.
diff --git a/libstdc++-v3/include/debug/helper_functions.h b/libstdc++-v3/include/debug/helper_functions.h
index 5a920bb9a6f..c3e7478f649 100644
--- a/libstdc++-v3/include/debug/helper_functions.h
+++ b/libstdc++-v3/include/debug/helper_functions.h
@@ -221,7 +221,7 @@ namespace __gnu_debug
#endif
template<typename _InputIterator>
- _GLIBCXX_CONSTEXPR
+ _GLIBCXX14_CONSTEXPR
inline bool
__valid_range(_InputIterator __first, _InputIterator __last)
{