From 65a3913d3af8905500289c03e8994a5205e159a0 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Mon, 18 Apr 2022 14:03:12 -0700 Subject: [PATCH] Annonate some functions _MSVC_CONSTEXPR Which is meaningless now, but will eventually become `[[msvc::constexpr]]`. This mirrors internal MSVC-PR-391437. --- stl/inc/memory | 2 +- stl/inc/xutility | 2 +- stl/inc/yvals_core.h | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stl/inc/memory b/stl/inc/memory index a678682ccc1..0c3307ec8ec 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -474,7 +474,7 @@ namespace ranges { noexcept(noexcept(::new (const_cast(static_cast(_Location))) _Ty(_STD forward<_Types>(_Args)...))) /* strengthened */ { // clang-format on - return ::new (const_cast(static_cast(_Location))) + _MSVC_CONSTEXPR return ::new (const_cast(static_cast(_Location))) _Ty(_STD forward<_Types>(_Args)...); } }; diff --git a/stl/inc/xutility b/stl/inc/xutility index 6f8fc7c4429..4320abff127 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -222,7 +222,7 @@ template ()) _Ty(_STD declval<_Types>()...))>> constexpr _Ty* construct_at(_Ty* const _Location, _Types&&... _Args) noexcept( noexcept(::new (_Voidify_iter(_Location)) _Ty(_STD forward<_Types>(_Args)...))) /* strengthened */ { - return ::new (_Voidify_iter(_Location)) _Ty(_STD forward<_Types>(_Args)...); + _MSVC_CONSTEXPR return ::new (_Voidify_iter(_Location)) _Ty(_STD forward<_Types>(_Args)...); } #endif // _HAS_CXX20 diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 3bddcdab080..6cea1f60ceb 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1546,5 +1546,9 @@ compiler option, or define _ALLOW_RTCc_IN_STL to acknowledge that you have recei #define _STL_INTERNAL_STATIC_ASSERT(...) #endif // _ENABLE_STL_INTERNAL_CHECK +#ifndef _MSVC_CONSTEXPR // TRANSITION, VS2022v17.3p2 +#define _MSVC_CONSTEXPR +#endif + #endif // _STL_COMPILER_PREPROCESSOR #endif // _YVALS_CORE_H_