From 137f67e91fb78f15b5407a27e94d9dded8df818c Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 4 Apr 2022 14:38:08 -0700 Subject: [PATCH] gmock: improve SFINAE for actions involving arguments. Avoid instantiating functions like std::get for an out of range index when doing SFINAE on the invocability of the action itself. PiperOrigin-RevId: 439415110 Change-Id: Ifc20285a6d526c34830870cd1910c2b2b92e1e81 --- googlemock/include/gmock/gmock-actions.h | 3 ++- googlemock/include/gmock/gmock-more-actions.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index 26272e9f..2c4ce363 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -1077,7 +1077,8 @@ struct ReturnNewAction { template struct ReturnArgAction { - template + template ::type> auto operator()(Args&&... args) const -> decltype(std::get( std::forward_as_tuple(std::forward(args)...))) { return std::get(std::forward_as_tuple(std::forward(args)...)); diff --git a/googlemock/include/gmock/gmock-more-actions.h b/googlemock/include/gmock/gmock-more-actions.h index 87307f09..148ac017 100644 --- a/googlemock/include/gmock/gmock-more-actions.h +++ b/googlemock/include/gmock/gmock-more-actions.h @@ -600,7 +600,8 @@ auto InvokeArgument(F f, Args... args) -> decltype(f(args...)) { template struct InvokeArgumentAction { - template + template ::type> auto operator()(Args&&... args) const -> decltype(internal::InvokeArgument( std::get(std::forward_as_tuple(std::forward(args)...)), std::declval()...)) {