Closed Nosenzor closed 1 month ago
Can you provide a simple reproducer? Maybe on godbolt?
I did that if it can help it's a copy of my code that use xsimd: https://godbolt.org/z/ofvzT1Ejv
On godbolt it compiles with gcc and clang but not with MSVC but i'm not sure it is the same issue.
Also note that vcpkg team is able to reproduce the error, maybe there's a port error?
When I compile on a windows computer i had to comment those lines (fortunately it works without it in my case.:
Is this a function that has changed recently ?
// Provide a generic float -> uint32_t cast only if we have a
// non-generic float -> int32_t fast_cast
// template <class A, class _ = decltype(fast_cast(std::declval<batch<float, A> const&>(), std::declval<batch<int32_t, A> const&>(), A {}))>
// XSIMD_INLINE batch<uint32_t, A> fast_cast(batch<float, A> const& v, batch<uint32_t, A> const&, requires_arch<generic>) noexcept
// {
// auto is_large = v >= batch<float, A>(1u << 31);
// auto small = bitwise_cast<float>(batch_cast<int32_t>(v));
// auto large = bitwise_cast<float>(
// batch_cast<int32_t>(v - batch<float, A>(1u << 31))
// ^ batch<int32_t, A>(1u << 31));
// return bitwise_cast<uint32_t>(select(is_large, large, small));
// }
it's caused by #define small char https://learn.microsoft.com/uk-ua/windows/win32/midl/-char
As a workaround you can try defining
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
before including Windows headers if you don't use anything from there. Or do undefs after Windows headers but before including xsimd
#ifdef small
#undef small
#endif
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
#include <xsimd/xsimd.hpp>
Ooh no... not this stupid thing from ms again ! I've been caught so many time by min max macros but never by the small one. The turnaround would work for me but you should integrate that in a release update.
BTW i don't have windows specif headers, but those define are somewhere set by the compiler. There's q NOMINMAX to set in cmake but not sure it works for small.
I've found this issue when using
xsimd
throughvcpkg
.I've filed a bug in vcpkg too, but i thought i should open it here too.