Skip to content
Snippets Groups Projects
Unverified Commit 27f6b376 authored by Jonathan Wakely's avatar Jonathan Wakely Committed by Jonathan Wakely
Browse files

libstdc++: Fix ranges::copy_backward for a single memcpyable element [PR117121]

The result iterator needs to be decremented before writing to it.

Improve the PR 108846 tests for all of std::copy, std::copy_n,
std::copy_backward, and the std::ranges versions.

libstdc++-v3/ChangeLog:

	PR libstdc++/117121
	* include/bits/ranges_algobase.h (copy_backward): Decrement
	output iterator before assigning one element through it.
	* testsuite/25_algorithms/copy/108846.cc: Ensure the algorithm's
	effects are correct for a single memcpyable element.
	* testsuite/25_algorithms/copy_backward/108846.cc: Likewise.
	* testsuite/25_algorithms/copy_n/108846.cc: Likewise.
parent 2ef62aa1
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment