From bae87d3f066be025b148bb5f2f5ba91214abc3fc Mon Sep 17 00:00:00 2001 From: mogemimi Date: Wed, 18 Sep 2024 03:36:22 +0900 Subject: [PATCH] Use _MSVC_LANG instead of __cplusplus in MSVC --- pomdog/utility/spin_lock.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pomdog/utility/spin_lock.h b/pomdog/utility/spin_lock.h index b422dc9d4..3c31ab5da 100644 --- a/pomdog/utility/spin_lock.h +++ b/pomdog/utility/spin_lock.h @@ -13,7 +13,12 @@ namespace pomdog::detail { class POMDOG_EXPORT SpinLock final { std::atomic_flag flag_; +#if defined(_MSC_VER) && defined(_MSVC_LANG) + // NOTE: https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ + static_assert(_MSVC_LANG >= 202002L, "ATOMIC_FLAG_INIT was deprecated in C++20, https://cplusplus.github.io/LWG/issue3659"); +#else static_assert(__cplusplus >= 202002L, "ATOMIC_FLAG_INIT was deprecated in C++20, https://cplusplus.github.io/LWG/issue3659"); +#endif public: SpinLock() noexcept;