diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index 7e78c09a..aad07d51 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -1428,8 +1428,10 @@ struct WithArgsAction { // MSVC complains about the I parameter pack not being // expanded (error C3520) despite it being expanded in the // type alias. - OnceAction>::type...)>>::value, + // TupleElement is also an MSVC workaround. + // See its definition for details. + OnceAction>...)>>::value, int>::type = 0> operator OnceAction() && { // NOLINT struct OA { @@ -1453,8 +1455,10 @@ struct WithArgsAction { // MSVC complains about the I parameter pack not being // expanded (error C3520) despite it being expanded in the // type alias. - Action>::type...)>>::value, + // TupleElement is also an MSVC workaround. + // See its definition for details. + Action>...)>>::value, int>::type = 0> operator Action() const { // NOLINT Action> converted(inner_action); diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h index 92d8eb9d..2678920b 100644 --- a/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -453,6 +453,13 @@ struct Function { template constexpr size_t Function::ArgumentCount; +// Workaround for MSVC error C2039: 'type': is not a member of 'std' +// when std::tuple_element is used. +// See: https://github.com/google/googletest/issues/3931 +// Can be replaced with std::tuple_element_t in C++14. +template +using TupleElement = typename std::tuple_element::type; + bool Base64Unescape(const std::string& encoded, std::string* decoded); #ifdef _MSC_VER