[PATCH] D115163: Fix compilation of Google Test in C++20 mode
    Evgeny Mandrikov via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Dec  6 08:55:26 PST 2021
    
    
  
Godin created this revision.
Godin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
  rG LLVM Github Monorepo
https://reviews.llvm.org/D115163
Files:
  llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h
Index: llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h
===================================================================
--- llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h
+++ llvm/utils/unittest/googlemock/include/gmock/gmock-actions.h
@@ -825,7 +825,8 @@
   Class* const obj_ptr;
   const MethodPtr method_ptr;
 
-  using ReturnType = typename std::result_of<MethodPtr(Class*)>::type;
+  using ReturnType =
+      decltype((std::declval<Class*>()->*std::declval<MethodPtr>())());
 
   template <typename... Args>
   ReturnType operator()(const Args&...) const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115163.392090.patch
Type: text/x-patch
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211206/ecb8f021/attachment.bin>
    
    
More information about the llvm-commits
mailing list