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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2025-07-03
     Ever confirmed|0                           |1
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=59948
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The difference is in the case of the lambda it is not an indirect function call
so the test call/lambda is inlined early into std::ranges::count_if and that
will be inlined into count2/test2 to get the non loop version.

In the case of std::bind_front, there is an indirect function call.
std::ranges::count_if is not early inlined into count1 and the indirect
function call is NOT turned into a direct function call until after inlining so
we miss out that Foo::find not being inlined and then the loop stays around.

Reply via email to