When compiling with the latest Visual Studio (2019 -- 16.1.1) and targeting the app for ARM64, a warning is emitted when using a boost::mutex instance. Namely, here's the warning:
boost\thread\win32\basic_timed_mutex.hpp(271,1): warning C4302: 'type cast': truncation from 'void *const ' to 'long'
The fix is in boost/detail/interlocked.hpp. Namely, on line 73 in interlocked.hpp, change this:
# if defined(_M_IA64) || defined(_M_AMD64) || defined(__x86_64__) || defined(__x86_64)
When compiling with the latest Visual Studio (2019 -- 16.1.1) and targeting the app for ARM64, a warning is emitted when using a
boost::mutex
instance. Namely, here's the warning:The fix is in
boost/detail/interlocked.hpp
. Namely, on line 73 in interlocked.hpp, change this:To this:
Note that
_M_IX86
,_M_ARM
, and_M_ARM64
are all checked and use intrinsics. This follows the documentation from Microsoft: _InterlockedCompareExchangePointer Intrinsic FunctionsThis change both fixes the warning for ARM64 apps, as well as uses the available and documented intrinsics for x86 apps.
Originally reported over here: https://github.com/boostorg/thread/issues/285