Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 25, 2025

This PR fixes two critical C++20 compatibility issues that prevent the project from building with modern C++ standards:

Issues Fixed

1. Deprecated std::result_of Usage

The std::result_of type trait was deprecated in C++14 and removed in C++17. The code was using it in the ThreadPool template implementation:

// Before (deprecated)
template<typename F>
auto enqueue(F&& f) -> std::future<typename std::result_of<F()>::type>;

// After (C++20 compatible)
template<typename F>
auto enqueue(F&& f) -> std::future<typename std::invoke_result_t<F>>;

2. Type Mismatch in std::max

The std::max function requires both arguments to be the same type. The code was mixing Lamports (uint64_t) with unsigned long:

// Before (type mismatch)
nonce_account.lamports = std::max(nonce_account.lamports, 1447680UL);

// After (types match)
nonce_account.lamports = std::max(nonce_account.lamports, static_cast<Lamports>(1447680UL));

Changes Made

Files Modified:

  • include/svm/enhanced_engine.h: Updated ThreadPool template declaration
  • src/svm/enhanced_engine.cpp: Updated ThreadPool template implementation (2 locations)
  • src/svm/spl_programs.cpp: Fixed std::max type casting in nonce account initialization

Verification

  • ✅ All 16 test suites pass (100% success rate)
  • ✅ Clean build with C++20 standard
  • ✅ No remaining deprecated API usage
  • ✅ Verified with strict compiler warnings (-Wall -Wextra -Werror)

These minimal surgical changes ensure the codebase compiles with modern C++ standards while preserving all existing functionality and performance characteristics.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] build arise from two main causes: deprecated C++ standard library features and a misuse of std::max. 1. std::result_of removed in C++17: Your code references std::result_of, which is no longer present in C++17 and later. Replace std::result_of with st... Fix C++20 compatibility: replace deprecated std::result_of and fix std::max type mismatch Aug 25, 2025
Copilot AI requested a review from 0xrinegade August 25, 2025 09:38
Copilot finished work on behalf of 0xrinegade August 25, 2025 09:38
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.

2 participants