<__msvc_threads_core.hpp>: Use aligned byte arrays as aligned buffers by frederick-vs-ja · Pull Request #5811 · microsoft/STL (original) (raw)
I've pushed a commit to perma-workaround VSO-2616030 "/clr /std:c++20 alignas emits bogus error C3645: 'main::<lambda_1>::<lambda_invoker_clrcall>': __clrcall cannot be used on functions compiled to native code", which I fully reduced and reported to be a good kitty. This is specific to storing the now-alignas-using mutex as a local variable within a lambda taking a UDT parameter (in this case stop_token). Moving the mutex and condition_variable_any outside of the lambda and capturing them by reference, as tests later in this file already do, (1) avoids the compiler bug, (2) is more realistic, and (3) preserves the test semantics, so I chose this as a perma-workaround.
As a drive-by cleanup, I couldn't resist removing unnecessary static from non-array constexpr variables.