From: Evgeny Mandrikov Date: Mon, 6 Dec 2021 17:06:51 +0000 (+0100) Subject: Fix compilation of Google Test in C++20 mode X-Git-Tag: upstream/15.0.7~23884 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c94eb0f9ef5597bd1b3b0efda4df53f606a1fe13;p=platform%2Fupstream%2Fllvm.git Fix compilation of Google Test in C++20 mode Without this patch when using CMAKE_CXX_STANDARD=20 and MSVC 19.30.30705.0 compilation of unit tests fails with llvm\utils\unittest\googlemock\include\gmock/gmock-actions.h(828): error C2039: 'result_of': is not a member of 'std' Patch is taken from Google Test: https://github.com/google/googletest/commit/61f010d703b32de9bfb20ab90ece38ab2f25977f Do not use std::result_of as it was removed in C++20. Differential Revision: https://reviews.llvm.org/D115163 --- diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h index 0a997a2..52624cd 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h @@ -825,7 +825,8 @@ struct InvokeMethodWithoutArgsAction { Class* const obj_ptr; const MethodPtr method_ptr; - using ReturnType = typename std::result_of::type; + using ReturnType = + decltype((std::declval()->*std::declval())()); template ReturnType operator()(const Args&...) const {