Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::result_of is removed in C++20 #2914

Closed
robindegen opened this issue Jun 27, 2020 · 7 comments
Closed

std::result_of is removed in C++20 #2914

robindegen opened this issue Jun 27, 2020 · 7 comments

Comments

@robindegen
Copy link

robindegen commented Jun 27, 2020

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*>;
@sbenzaquen
Copy link
Collaborator

That code has already been replaced in 61f010d

@robindegen
Copy link
Author

robindegen commented Jun 29, 2020

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

@Andreas-Schniertshauer
Copy link

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

@Andreas-Schniertshauer
Copy link

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

@milbrandt
Copy link

As C++20 is now officially approved it would be time to have that released.

@twhiting
Copy link

Hi, also adding to this. Waiting on this release w/ the fix.

@jwmcglynn
Copy link

I had this issue and resolved it after upgrading to v1.11.0, so I think the fix landed in that release.

jwmcglynn added a commit to jwmcglynn/donner that referenced this issue Dec 13, 2021
libc++13 has better support for ranges.

To enable the upgrade, downgrade the devcontainer to Ubuntu Bionic,
since the previous version was introducing dependency issues because it
uses libpython3.9, and the liblldb package for some reason has a
dependency on libpython3.8, which cannot be resolved.  Note that this is
two versions back, since this is the only other one that also supports
arm64 for M1 macs.

Also upgrade gtest to v1.11.0, since the previous version was relying on
a the deprecated `std::result_of` API, which is removed in C++20.  This
version of libc++ removes the API.

See google/googletest#2914
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants