From: <sv...@op...> - 2025-03-01 20:03:25
|
Author: manx Date: Sat Mar 1 21:03:08 2025 New Revision: 22978 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22978 Log: [Fix] So, apparently Microsoft's iterator debugging is not standard-complaint in that it does not support constexpr containers (i.e. constexpr auto foo = std::vector<int>{}; does not compile in default Debug builds). Set MPT_LIBCXX_QUIRK_NO_CXX20_CONSTEXPR_CONTAINER based on whether (_ITERATOR_DEBUG_LEVEL >= 1). Fixes r22906 for MSVC Debug builds. See also r22744. Modified: trunk/OpenMPT/src/mpt/base/detect_quirks.hpp Modified: trunk/OpenMPT/src/mpt/base/detect_quirks.hpp ============================================================================== --- trunk/OpenMPT/src/mpt/base/detect_quirks.hpp Sat Mar 1 20:58:20 2025 (r22977) +++ trunk/OpenMPT/src/mpt/base/detect_quirks.hpp Sat Mar 1 21:03:08 2025 (r22978) @@ -17,6 +17,11 @@ #include <array> #endif // C++20 +#if MPT_LIBCXX_MS +// for _ITERATOR_DEBUG_LEVEL +#include <array> +#endif // MPT_LIBCXX_MS + #if MPT_OS_DJGPP @@ -277,9 +282,22 @@ #if MPT_CXX_AT_LEAST(20) #if MPT_LIBCXX_GNU_BEFORE(12) || MPT_LIBCXX_LLVM_BEFORE(15000) || (MPT_LIBCXX_MS && MPT_MSVC_BEFORE(2022, 0)) || (MPT_LIBCXX_MS && !MPT_COMPILER_MSVC) +#ifndef MPT_LIBCXX_QUIRK_NO_CXX20_CONSTEXPR_CONTAINER +#define MPT_LIBCXX_QUIRK_NO_CXX20_CONSTEXPR_CONTAINER +#endif +#endif +#if MPT_LIBCXX_MS +// So, in 2025, Microsoft still ships a STL that by default is not standard-compliant with its own default Debug options. +// constexpr auto foo = std::vector<int>{}; does not compile with iterator debugging enabled (i.e. in Debug builds). +#if defined(_ITERATOR_DEBUG_LEVEL) +#if (_ITERATOR_DEBUG_LEVEL >= 1) +#ifndef MPT_LIBCXX_QUIRK_NO_CXX20_CONSTEXPR_CONTAINER #define MPT_LIBCXX_QUIRK_NO_CXX20_CONSTEXPR_CONTAINER #endif #endif +#endif +#endif +#endif |