Fix MSVC 19.44 (VS 2022) build of multidual

Summary

MSVC 19.44.35226.0 (Visual Studio 2022 Enterprise, /std:c++17) fails to build duals/multidual due to two C++17 constructs the compiler doesn't accept:

  1. Fold expression inside std::enable_if_t in the N>1 variadic constructor of partials<T,N>:

    error C2059: syntax error: '...'

    The expression (std::is_convertible<Args, T>::value && ...) trips MSVC's SFINAE parser. Replaced with the equivalent std::conjunction_v<std::is_convertible<Args, T>...>.

  2. Brace-init return with implicit conversion in the user-defined literal operators (_ef, _e, _el):

    error C2440: 'return': cannot convert from 'initializer list' to 'duals::dual<float,1>'

    MSVC will not perform the implicit float -> partials<T,1> conversion inside a brace-init-list return. Replaced with explicit dual<T>(real, partials<T,1>(du)) construction.

Both changes are semantically identical for GCC/Clang and were verified locally — ./dev.sh build && ./dev.sh test builds cleanly and the only failing test (solveLu.float7) was already failing on master.

Reported against v0.8.2; the same issue is present in v0.8.4.

Test plan

  • CI passes on Clang/GCC (Linux)
  • Builds on MSVC 19.44 (VS 2022) with /std:c++17
  • test_multidual_1 continues to pass
Edited by Michael Tesch

Merge request reports

Loading