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:
-
Fold expression inside
std::enable_if_tin the N>1 variadic constructor ofpartials<T,N>:error C2059: syntax error: '...'The expression
(std::is_convertible<Args, T>::value && ...)trips MSVC's SFINAE parser. Replaced with the equivalentstd::conjunction_v<std::is_convertible<Args, T>...>. -
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 explicitdual<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_1continues to pass