SIGN IN SIGN UP

Re-sync extension/pytree/function_ref.h with LLVM (#10440)

We had an old version, and that version didn't work quite right when
handed a const ref to a callable. Just resync and note divergences
from the original in the comment. Our old version also had an
`explicit` constructor, which is *not* desirable because it
complicates callsites. It was also a divergence from both LLVM and
[the upcoming C++26 std::function_ref](https://en.cppreference.com/w/cpp/utility/functional/function_ref/function_ref).

The test made invalid use of a FunctionRef -- you can't keep one
around past the lifetime of the function object it refers to, but the
test held onto a temporary capturing lambda in an object. I fixed the
test.
S
Scott Wolchok committed
6feb623cb72afb63bf45a2537a1748400ce354fa
Parent: b415af0
Committed by GitHub <noreply@github.com> on 4/25/2025, 8:00:26 PM