Merge pull request #4994 from edge90:fix/onceaction-tuple-sfinae-order

PiperOrigin-RevId: 953630264
Change-Id: Iad16b5ee9a92ccb6b580733be18dbeb85371e66d
This commit is contained in:
Copybara-Service 2026-07-24 17:31:32 -07:00
commit 136a6b8865

View File

@ -427,21 +427,20 @@ class [[nodiscard]] OnceAction<Result(Args...)> final {
// via StdFunctionAdaptor.
template <typename Callable>
using IsDirectlyCompatible = internal::conjunction<
// It must be possible to capture the callable in StdFunctionAdaptor.
std::is_constructible<typename std::decay<Callable>::type, Callable>,
// The callable must be compatible with our signature.
internal::is_callable_r<Result, typename std::decay<Callable>::type,
Args...>>;
internal::is_callable_r<Result, std::decay_t<Callable>, Args...>,
// It must be possible to capture the callable in StdFunctionAdaptor.
std::is_constructible<std::decay_t<Callable>, Callable>>;
// True iff we can use the given callable type via StdFunctionAdaptor once we
// ignore incoming arguments.
template <typename Callable>
using IsCompatibleAfterIgnoringArguments = internal::conjunction<
// It must be possible to capture the callable in a lambda.
std::is_constructible<typename std::decay<Callable>::type, Callable>,
// The callable must be invocable with zero arguments, returning something
// convertible to Result.
internal::is_callable_r<Result, typename std::decay<Callable>::type>>;
internal::is_callable_r<Result, std::decay_t<Callable>>,
// It must be possible to capture the callable in a lambda.
std::is_constructible<std::decay_t<Callable>, Callable>>;
public:
// Construct from a callable that is directly compatible with our mocked