[Bug libstdc++/125981] std::find_if/std::mismatch dereference the past-the-end iterator when the predicate result type has an ADL-reachable operator&&

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 22 13:32:13 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125981

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2026-07-22
     Ever confirmed|0                           |1
   Target Milestone|---                         |16.3

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The code has undefined behaviour, but it used to "work" because we wrapped the
predicate in our __iter_pred helper which returns bool. So this was a change in
behaviour in gcc-16. We could add the casts to bool as QoI anyway.


More information about the Gcc-bugs mailing list