Files
gcc/libstdc++-v3/testsuite/21_strings/basic_string
François Dumont c0b659db1a libstdc++: [_GLIBCXX_DEBUG] Fix COW string valid range check
In revision 698a6af5dc the _GLIBCXX_DEBUG code
for the Library Defect 438 has been removed as starting in C++11 the iterator
type is constrained through the _RequireInputIter requirement.

But the COW basic_string implementation used when _GLIBCXX_USE_CXX11_ABI=0 is
missing the _RequireInputIter constraint on a number of methods resulting in test
failures.

For the moment move the culprit __glibcxx_requires_valid_range call in the COW
basic_string implementation in a method where the iterator type has already been
checked.

libstdc++-v3/ChangeLog:

	* include/bits/cow_string.h
	(basic_string::replace(iterator, iterator, _InputIte, _InputIte)): Move
	__glibcxx_requires_valid_range to...
	(basic_string::_M_replace_dispatch(iterator, iterator, _InputIte,
	_InputIte, __fase_type)): ...here.
	* testsuite/21_strings/basic_string/debug/append_neg.cc: New test case.
	* testsuite/21_strings/basic_string/debug/assign_neg.cc: New test case.
	* testsuite/21_strings/basic_string/debug/construct_neg.cc: New test case.
	* testsuite/21_strings/basic_string/debug/insert_neg.cc: New test case.
	* testsuite/21_strings/basic_string/debug/replace_neg.cc: New test case.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2026-04-01 18:59:24 +02:00
..