Skip to content

Fix MSVC for C++20 - #5159

Merged
graydon merged 3 commits into
stellar:masterfrom
graydon:fix-cpp20-msvc
Feb 27, 2026
Merged

graydon merged 3 commits into
stellar:masterfrom
graydon:fix-cpp20-msvc

Conversation

@graydon

@graydon graydon commented Feb 27, 2026 •

Copy link
Copy Markdown
Contributor

This extends PR #5091 with fixes to the msvc build. It should merge after that PR. Only the second commit here is relevant.

Copilot AI review requested due to automatic review settings February 27, 2026 08:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the codebase from C++17 to C++20 to fix MSVC compilation issues. The changes primarily update compiler settings, library dependencies, and adjust code to be compatible with C++20 requirements and newer versions of the fmt library.

Changes:

  • Updated C++ standard from C++17 to C++20 across build configurations and documentation
  • Modified fmt library usage to accommodate breaking changes (wrapping format strings with fmt::runtime(), removing FMT_STRING macro, adding fmt/ranges.h includes)
  • Replaced deprecated C++ features (operator< with operator<=>, std::result_of with std::invoke_result_t, template parameter syntax)
  • Updated build configuration files and dependencies (xdrpp, spdlog, fmt submodules)

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/util/xdrquery/XDRQueryEval.cpp Added fmt/ranges.h include for fmt compatibility
src/util/xdrquery/XDRFieldResolver.h Added fmt/ranges.h include for fmt compatibility
src/util/XDROperators.h Replaced operator< with C++20 spaceship operator (operator<=>)
src/util/Logging.h Removed FMT_STRING macro wrapping from logging macros
src/util/Logging.cpp Wrapped format string with fmt::runtime() and replaced fmt::localtime() with std::localtime()
src/util/DebugMetaUtils.h Changed std::string constant to constexpr char array for compile-time format string
src/test/test.cpp Added fmt/ranges.h include
src/main/test/ConfigTests.cpp Changed string constants to constexpr char arrays and wrapped format string with fmt::runtime()
src/ledger/LedgerEntryScope.h Removed redundant template parameter from deleted constructor
src/history/HistoryArchive.cpp Wrapped format string with fmt::runtime() for dynamic formatting
m4/ax_cxx_compile_stdcxx_14.m4 Removed obsolete C++14 standard check macro file
m4/ax_cxx_compile_stdcxx.m4 Updated to support C++20 and C++23, added MSVC-specific compiler flag handling
lib/xdrpp Updated submodule commit for C++20 compatibility
lib/spdlog Updated submodule commit for C++20 compatibility
lib/fmt Updated submodule commit for newer fmt library version
lib/autocheck/include/autocheck/classifier.hpp Replaced deprecated std::result_of with std::invoke_result_t
configure.ac Updated to require C++20 standard instead of C++17
README.md Updated documentation to reflect C++20 requirement
INSTALL.md Updated build dependencies to specify C++20 support requirement
Builds/VisualStudio/*.vcxproj Updated MSVC projects to use C++20 standard and added UTF-8 compiler flag

dmkozh
dmkozh previously approved these changes Feb 27, 2026
@dmkozh

dmkozh commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Could you please rebase instead of merging?

@graydon
graydon added this pull request to the merge queue Feb 27, 2026
@drebelsky drebelsky mentioned this pull request Feb 27, 2026
Merged via the queue into stellar:master with commit 5b28881 Feb 27, 2026
51 checks passed
@graydon
graydon deleted the fix-cpp20-msvc branch February 27, 2026 22:06
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

Successfully merging this pull request may close these issues.

5 participants