Googletest: std::result_of is removed in C++20

Created on 27 Jun 2020  路  4Comments  路  Source: google/googletest

std::result_of is removed in C++20, causing gmock-actions.h:819 to fail in Visual Studio 2019 16.6.2 with C++20 enabled. However std::invoke_result is available since C++17.

For C++20:

  using ReturnType = typename std::result_of<MethodPtr(Class*)>::type;

should be replaced with:

  using ReturnType = typename std::invoke_result_t<MethodPtr, Class*>;

Most helpful comment

I need this fix too - getting this error C2039: 'result_of': is not a member of 'std' when compiling with Visual Studio 2019 16.7.2 for googletest-release-1.10.0

All 4 comments

@sbenzaquen Is there any timeline for an official release that contains this fix?

I need this fix too - getting this error C2039: 'result_of': is not a member of 'std' when compiling with Visual Studio 2019 16.7.2 for googletest-release-1.10.0

Is there any plan to release a new version of googletest in the near future where this problem is solved?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AstralStorm picture AstralStorm  路  4Comments

ebioman picture ebioman  路  3Comments

Joebeazelman picture Joebeazelman  路  5Comments

nholthaus picture nholthaus  路  6Comments

agirault picture agirault  路  5Comments