[Bug libstdc++/120384] [13/14/15 Regression] _BinaryPredicateConcept checks in std::unique_copy are wrong
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 3 19:50:20 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120384
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:af7c492712edab3bb46d3ad48bdd9ad719b000d7
commit r15-11249-gaf7c492712edab3bb46d3ad48bdd9ad719b000d7
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed May 21 16:57:59 2025 +0100
libstdc++: Fix concept checks for std::unique_copy [PR120384]
This looks to have been wrong since r0-125454-gea89b2482f97aa which
introduced the predefined_ops.h. Since that change, the binary predicate
passed to std::__unique_copy is _Iter_comp_iter, which takes arguments
of the iterator type, not the iterator's value type.
This removes the checks from the __unique_copy overloads and moves them
into the second overload of std::unique_copy, where we have the original
binary predicate, not the adapted one from predefined_ops.h.
The third __unique_copy overload currently checks that the predicate is
callable with the input range value type and the output range value
type. This change alters that, so that we only ever check that the
predicate can be called with two arguments of the same type. That is
intentional, because calling the predicate with different types is a bug
that will be fixed in a later commit (see PR libstdc++/120386).
libstdc++-v3/ChangeLog:
PR libstdc++/120384
* include/bits/stl_algo.h (__unique_copy): Remove all
_BinaryPredicateConcept concept checks.
(unique_copy): Check _BinaryPredicateConcept in overload that
takes a predicate.
* testsuite/25_algorithms/unique_copy/120384.cc: New test.
Reviewed-by: Tomasz KamiÅski <tkaminsk@redhat.com>
(cherry picked from commit 1bb7a195e7cf95537534a42e7aa8705cc78eba4e)
More information about the Gcc-bugs
mailing list