Project

General

Profile

Actions

Emulator Issues #11970

closed

fmt 5.3.0 is incompatible with C++20

Added by STL_MSFT about 4 years ago. Updated about 4 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Current
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
Yes
Regression start:
Fixed in:
5.0-11622

Description

https://github.com/dolphin-emu/dolphin/tree/master/Externals/fmt is currently version 5.3.0 (released Dec 28, 2018). This version used std::result_of, which was deprecated in C++17 and removed in C++20. MSVC has implemented this removal (by merging https://github.com/microsoft/STL/pull/380 which will ship in VS 2019 16.6 Preview 2 in the near-ish future). This causes Dolphin to fail to build in C++20 mode:

F:\gitP\dolphin-emu\dolphin\Externals\fmt\include\fmt\core.h(202,25): error C2039: 'result_of': is not a member of 'std' [F:\gitP\dolphin-emu\dolphin\Source\Core\Common\Common.vcxproj]

We (the MSVC team) are seeing this because we test a number of open-source projects, including Dolphin, with development builds of the MSVC toolset. This allows us to find and fix bugs in our toolset before they can affect you, and it also allows us to provide advance notice of source-breaking incompatibilities like this one.

Fortunately, the fmt library has already been fixed to deal with the deprecation and removal of std::result_of. (It appears this was https://github.com/fmtlib/fmt/pull/1028 followed by more commits; I don't recommend attempting to port individual patches.) I believe that the first fixed version was fmt 6.0.0 (released Aug 26, 2019), but it would be best to upgrade to the latest release, fmt 6.1.2 (released Dec 11, 2019).

If upgrading the version of fmt used by Dolphin is difficult at this time, MSVC provides "escape hatch" macros that can be defined project-wide to suppress the deprecation warning and restore the removed type trait. (Specifically, compiling with /D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING and /D_HAS_DEPRECATED_RESULT_OF=1 .) However, upgrading fmt is the best solution here.

Actions #1

Updated by Billiard26 about 4 years ago

  • Status changed from New to Accepted
Actions #2

Updated by JosJuice about 4 years ago

  • Milestone set to Current
  • Relates to maintainability changed from No to Yes
Actions #3

Updated by Lioncash about 4 years ago

  • Status changed from Accepted to Fix pending

This should be fixed in https://github.com/dolphin-emu/dolphin/pull/8602. Thanks for reporting it!

Actions #4

Updated by JosJuice about 4 years ago

  • Status changed from Fix pending to Fixed
  • Fixed in set to 5.0-11622
Actions #5

Updated by STL_MSFT about 4 years ago

Thanks for the quick fix!

Actions

Also available in: Atom PDF