[patch] libstdc++/59603 Prevent self-swapping in random_shuffle

Jonathan Wakely jwakely@redhat.com
Wed Oct 1 12:35:00 GMT 2014


On 12/09/14 14:34 +0100, Jonathan Wakely wrote:
>Swapping an object with itself is pointless, and asserts in debug mode
>(but we should probably remove that check from debug mode, since it
>can happen in reasonable code).
>
>Tested x86_64-linux, committed to trunk.
>
>I think this makes sense for the branches too, so will backport it
>soon.

Now committed to the 4.9 branch (without the comment Chris didn't
like).

>    	PR libstdc++/59603
>    	* include/bits/stl_algo.h (random_shuffle): Prevent self-swapping.
>    	* testsuite/25_algorithms/random_shuffle/59603.cc: New.




More information about the Libstdc++ mailing list