Skip to content

Fix the build with Visual Studio 2026 (MSVC 14.50+) - #56

Merged
xcelerit-team merged 2 commits into
mainfrom
fix/msvc-14.51-random
Nov 13, 2026
Merged

xcelerit-team merged 2 commits into
mainfrom
fix/msvc-14.51-random

Conversation

@auto-differentiation-dev

Copy link
Copy Markdown
Contributor

QuantLibAAD fails to compile with the Visual Studio 2026 toolset (MSVC 14.50 and later): ql/qlaad.hpp specialises the MSVC STL's internal _Has_static_min_max trait, which 14.50 turned into a variable template and 14.51 removed. The specialisation is only needed for STLs before VS 2022 17.12, whose std::generate_canonical builds constexpr values of the result type; later versions no longer do that and work with AD types directly.

Changes

  • Apply the std::mt19937 workaround only for MSVC STLs older than VS 2022 17.12.
  • Add a Visual Studio 2026 entry (C++17, AAD enabled) to the Windows CI job.

Testing

The Windows CI jobs build and run the QuantLib test suite with AD types, including the tests that draw from std random distributions with std::mt19937 (cat bond beta risk, firefly, particle swarm and simulated annealing optimizers). VS 2022 (17.14) now takes the standard generate_canonical path; the new VS 2026 job covers the toolset that failed.

VS 2026 (MSVC 14.50+) made _Has_static_min_max a variable template and then removed it, so the specialisation no longer compiles. Since VS 2022 17.12 generate_canonical works with AD types without it.
@xcelerit-team
xcelerit-team merged commit acc90e1 into main Nov 13, 2026
18 of 46 checks passed
@xcelerit-team
xcelerit-team deleted the fix/msvc-14.51-random branch November 13, 2026 19:56
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