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

Use of deprecated function call (result_of) #1025

Closed
mzlarsson opened this issue Feb 1, 2019 · 2 comments
Closed

Use of deprecated function call (result_of) #1025

mzlarsson opened this issue Feb 1, 2019 · 2 comments

Comments

@mzlarsson
Copy link

This is just a minor issue but I thought I ought to mention it anyway. The core.h file contains calls to the deprecated function result_of. result_of has been deprecated since the release of C++17 based on these reasons and should not be used. std::invoke_result is the preferred method instead nowadays.

... fmt/bundled/core.h:215:25: error: 'result_of<fmt::v5::internal::precision_checker<fmt::v5::internal::error_handler> (int)>' is deprecated: warning STL4014: std::result_of and std::result_of_t are deprecated in C++17. They are superseded by std::invoke_result and std::invoke_result_t. You can define _SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [clang-diagnostic-deprecated-declarations] typedef typename std::result_of<

@DanielaE
Copy link
Contributor

DanielaE commented Feb 3, 2019

You are right. In C++20 std::result_of will be outright banned. I've created an experimental implementation using std::invoke_result when the compiler allows to DanielaE@c08ee68. My impressions from reading everything I could find on the correct usage of std::invoke_result, it should be equivalent. Alas, all major compilers (clang, gcc, and msvc) agree on failing in C++17 mode because of errors like "'visit_format_arg': no matching overloaded function found": Travis

@vitaut: do you happen to have an idea about that I am doing wrong?

@DanielaE
Copy link
Contributor

DanielaE commented Feb 3, 2019

Nevermind - I got it ...

DanielaE added a commit to DanielaE/fmt that referenced this issue Feb 3, 2019
…ib#1025)

C++17 deprecated 'std::result_of' in favour of 'std::invoke_result' and will ban it outright in C++20. Therefore
- implement 'internal::result_of' in terms of 'std::invoke_result' when compiling C++17 mode.
- implement 'internal::result_of' in terms of 'std::result_of' when compiling in modes C++11 or C++14.

Signed-off-by: Daniela Engert <[email protected]>
vitaut pushed a commit that referenced this issue Feb 4, 2019
C++17 deprecated 'std::result_of' in favour of 'std::invoke_result' and will ban it outright in C++20. Therefore
- implement 'internal::result_of' in terms of 'std::invoke_result' when compiling C++17 mode.
- implement 'internal::result_of' in terms of 'std::result_of' when compiling in modes C++11 or C++14.

Signed-off-by: Daniela Engert <[email protected]>
@vitaut vitaut closed this as completed Feb 4, 2019
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

3 participants