gcc/libstdc++-v3/testsuite/21_strings/char_traits/requirements
Jonathan Wakely 15cc291887 libstdc++: Fix std::char_traits<C>::move [PR113200]
The current constexpr implementation of std::char_traits<C>::move relies
on being able to compare the pointer parameters, which is not allowed
for unrelated pointers. We can use __builtin_constant_p to determine
whether it's safe to compare the pointers directly. If not, then we know
the ranges must be disjoint and so we can use char_traits<C>::copy to
copy forwards from the first character to the last. If the pointers can
be compared directly, then we can simplify the condition for copying
backwards to just two pointer comparisons.

libstdc++-v3/ChangeLog:

	PR libstdc++/113200
	* include/bits/char_traits.h (__gnu_cxx::char_traits::move): Use
	__builtin_constant_p to check for unrelated pointers that cannot
	be compared during constant evaluation.
	* testsuite/21_strings/char_traits/requirements/113200.cc: New
	test.
2024-01-05 10:23:35 +00:00
..
char Update copyright years. 2024-01-03 12:19:35 +01:00
char8_t Update copyright years. 2024-01-03 12:19:35 +01:00
char16_t Update copyright years. 2024-01-03 12:19:35 +01:00
char32_t Update copyright years. 2024-01-03 12:19:35 +01:00
explicit_instantiation Update copyright years. 2024-01-03 12:19:35 +01:00
short Update copyright years. 2024-01-03 12:19:35 +01:00
wchar_t Update copyright years. 2024-01-03 12:19:35 +01:00
113200.cc libstdc++: Fix std::char_traits<C>::move [PR113200] 2024-01-05 10:23:35 +00:00
constexpr_functions.cc Update copyright years. 2024-01-03 12:19:35 +01:00
constexpr_functions_c++17.cc Update copyright years. 2024-01-03 12:19:35 +01:00
constexpr_functions_c++20.cc Update copyright years. 2024-01-03 12:19:35 +01:00
version.cc libstdc++: Test for feature test macros more accurately 2023-11-16 08:06:59 +00:00