diff --git a/stl/inc/algorithm b/stl/inc/algorithm index 8aab1113539..ab07cb468e8 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -97,7 +97,7 @@ __declspec(noalias) void _Reverse_copy_vectorized(const void* _First, const void } else if constexpr (_Nx == 8) { ::__std_reverse_copy_trivially_copyable_8(_First, _Last, _Dest); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -120,7 +120,7 @@ pair<_Ty*, _Ty*> _Minmax_element_vectorized(_Ty* const _First, _Ty* const _Last) } else if constexpr (sizeof(_Ty) == 8) { _Res = ::__std_minmax_element_8(_First, _Last, _Signed); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } return {const_cast<_Ty*>(static_cast(_Res._Min)), const_cast<_Ty*>(static_cast(_Res._Max))}; @@ -166,7 +166,7 @@ auto _Minmax_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { return ::__std_minmax_8u(_First, _Last); } } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -193,7 +193,7 @@ _Ty* _Find_last_vectorized(_Ty* const _First, _Ty* const _Last, const _TVal _Val return const_cast<_Ty*>( static_cast(::__std_find_last_trivial_8(_First, _Last, static_cast(_Val)))); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -213,7 +213,7 @@ _Ty1* _Find_first_of_vectorized( return const_cast<_Ty1*>( static_cast(::__std_find_first_of_trivial_8(_First1, _Last1, _First2, _Last2))); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -231,7 +231,7 @@ __declspec(noalias) void _Replace_vectorized( } else if constexpr (sizeof(_Ty) == 8) { ::__std_replace_8(_First, _Last, static_cast(_Old_val), static_cast(_New_val)); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } diff --git a/stl/inc/bit b/stl/inc/bit index 664621ee898..a253dc1a52e 100644 --- a/stl/inc/bit +++ b/stl/inc/bit @@ -72,7 +72,7 @@ _NODISCARD constexpr _Ty byteswap(const _Ty _Val) noexcept { } else if constexpr (sizeof(_Ty) == 8) { return static_cast<_Ty>(_Byteswap_uint64(static_cast(_Val))); } else { - static_assert(false, "Unexpected integer size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } #endif // _HAS_CXX23 diff --git a/stl/inc/chrono b/stl/inc/chrono index ffbfeeca181..65043919533 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -3037,7 +3037,7 @@ namespace chrono { static_assert(false, "A three-step clock time conversion is required to be unique, " "either utc-to-system or system-to-utc, but not both (N4950 [time.clock.cast.fn]/2)."); } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } @@ -5387,7 +5387,7 @@ namespace chrono { } else if constexpr (_Is_specialization_v<_Ty, _Local_time_format_t>) { return _Type == 'z' || _Type == 'Z' || _Is_valid_type(_Type); } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected type } } diff --git a/stl/inc/compare b/stl/inc/compare index 877eb67f1fa..2829fa5b873 100644 --- a/stl/inc/compare +++ b/stl/inc/compare @@ -453,7 +453,7 @@ namespace _Strong_order { } else if constexpr (_Strat == _St::_Three) { return static_cast(compare_three_way{}(_Left, _Right)); } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -579,7 +579,7 @@ namespace _Weak_order { return static_cast( static_cast(strong_order(_Left, _Right))); // intentional ADL } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -664,7 +664,7 @@ namespace _Partial_order { return static_cast( static_cast(strong_order(_Left, _Right))); // intentional ADL } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -720,7 +720,7 @@ namespace _Compare_strong_order_fallback { : _Left < _Right ? strong_ordering::less : strong_ordering::greater; } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -770,7 +770,7 @@ namespace _Compare_weak_order_fallback { : _Left < _Right ? weak_ordering::less : weak_ordering::greater; } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -829,7 +829,7 @@ namespace _Compare_partial_order_fallback { : _Right < _Left ? partial_ordering::greater : partial_ordering::unordered; } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; diff --git a/stl/inc/functional b/stl/inc/functional index 6d2d9c21f01..68d01df97b6 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -2605,7 +2605,7 @@ public: } else if constexpr (_Del == _Deletion_kind::_Normal_array) { delete[] _Ptr; } else { - static_assert(false, "Unknown _Deletion_kind."); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } } diff --git a/stl/inc/ranges b/stl/inc/ranges index d639701ec76..a5ead5a2a21 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -2030,7 +2030,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Own) { return owning_view{_STD forward<_Rng>(_Range)}; } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -2164,7 +2164,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_As_rvalue) { return as_rvalue_view{_STD forward<_Rng>(_Range)}; } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -3142,7 +3142,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Reconstruct_subrange) { return subrange(_First, _First + _Count); } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } } @@ -3548,7 +3548,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Reconstruct_other) { return remove_cvref_t<_Rng>(_RANGES begin(_Range) + _Count, _RANGES end(_Range)); } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } } @@ -5389,7 +5389,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Common) { return common_view{_STD forward<_Rng>(_Range)}; } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -5548,7 +5548,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Reverse) { return reverse_view{_STD forward<_Rng>(_Range)}; } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -5692,7 +5692,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_As_const) { return as_const_view{_STD forward<_Rng>(_Range)}; } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; diff --git a/stl/inc/tuple b/stl/inc/tuple index faafeb4451e..b9fa78920dd 100644 --- a/stl/inc/tuple +++ b/stl/inc/tuple @@ -954,8 +954,8 @@ _NODISCARD constexpr _Ty& get(tuple<_Types...>& _Tuple) noexcept { using _Ttype = typename tuple_element<_Idx, tuple<_Types...>>::_Ttype; return static_cast<_Ttype&>(_Tuple)._Myfirst._Val; } else { - static_assert( - false, "get(tuple&) requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)"); + static_assert(false, "get(tuple&) " + "requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)"); } } @@ -966,8 +966,8 @@ _NODISCARD constexpr const _Ty& get(const tuple<_Types...>& _Tuple) noexcept { using _Ttype = typename tuple_element<_Idx, tuple<_Types...>>::_Ttype; return static_cast(_Tuple)._Myfirst._Val; } else { - static_assert( - false, "get(const tuple&) requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)"); + static_assert(false, "get(const tuple&) " + "requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)"); } } @@ -978,8 +978,8 @@ _NODISCARD constexpr _Ty&& get(tuple<_Types...>&& _Tuple) noexcept { using _Ttype = typename tuple_element<_Idx, tuple<_Types...>>::_Ttype; return static_cast<_Ty&&>(static_cast<_Ttype&>(_Tuple)._Myfirst._Val); } else { - static_assert( - false, "get(tuple&&) requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)"); + static_assert(false, "get(tuple&&) " + "requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)"); } } @@ -990,8 +990,8 @@ _NODISCARD constexpr const _Ty&& get(const tuple<_Types...>&& _Tuple) noexcept { using _Ttype = typename tuple_element<_Idx, tuple<_Types...>>::_Ttype; return static_cast(static_cast(_Tuple)._Myfirst._Val); } else { - static_assert( - false, "get(const tuple&&) requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)"); + static_assert(false, "get(const tuple&&) " + "requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)"); } } diff --git a/stl/inc/variant b/stl/inc/variant index d6c3383dca1..bada3c55623 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -1196,8 +1196,8 @@ _NODISCARD constexpr decltype(auto) get(variant<_Types...>& _Var) { if constexpr (_Idx < sizeof...(_Types)) { return _STD get<_Idx>(_Var); } else { - static_assert( - false, "get(variant&) requires T to occur exactly once in Types. (N4971 [variant.get]/8)"); + static_assert(false, "get(variant&) " + "requires T to occur exactly once in Types. (N4971 [variant.get]/8)"); } } _EXPORT_STD template @@ -1207,8 +1207,8 @@ _NODISCARD constexpr decltype(auto) get(variant<_Types...>&& _Var) { if constexpr (_Idx < sizeof...(_Types)) { return _STD get<_Idx>(_STD move(_Var)); } else { - static_assert( - false, "get(variant&&) requires T to occur exactly once in Types. (N4971 [variant.get]/8)"); + static_assert(false, "get(variant&&) " + "requires T to occur exactly once in Types. (N4971 [variant.get]/8)"); } } _EXPORT_STD template @@ -1218,8 +1218,8 @@ _NODISCARD constexpr decltype(auto) get(const variant<_Types...>& _Var) { if constexpr (_Idx < sizeof...(_Types)) { return _STD get<_Idx>(_Var); } else { - static_assert(false, - "get(const variant&) requires T to occur exactly once in Types. (N4971 [variant.get]/8)"); + static_assert(false, "get(const variant&) " + "requires T to occur exactly once in Types. (N4971 [variant.get]/8)"); } } _EXPORT_STD template @@ -1229,8 +1229,8 @@ _NODISCARD constexpr decltype(auto) get(const variant<_Types...>&& _Var) { if constexpr (_Idx < sizeof...(_Types)) { return _STD get<_Idx>(_STD move(_Var)); } else { - static_assert(false, - "get(const variant&&) requires T to occur exactly once in Types. (N4971 [variant.get]/8)"); + static_assert(false, "get(const variant&&) " + "requires T to occur exactly once in Types. (N4971 [variant.get]/8)"); } } diff --git a/stl/inc/vector b/stl/inc/vector index c57c0f0fec6..cdf36d3f9bd 100644 --- a/stl/inc/vector +++ b/stl/inc/vector @@ -2077,7 +2077,7 @@ private: } else if constexpr (sizeof...(_Val) == 2) { _My_data._Mylast = _STD _Uninitialized_copy(_STD forward<_Valty>(_Val)..., _My_data._Myfirst, _Al); } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected number of arguments } _ASAN_VECTOR_CREATE; _Guard._Target = nullptr; diff --git a/stl/inc/xlocnum b/stl/inc/xlocnum index 2bba5171841..fa1db5215e0 100644 --- a/stl/inc/xlocnum +++ b/stl/inc/xlocnum @@ -1190,7 +1190,7 @@ int _Float_put_desired_precision(const streamsize _Precision, const ios_base::fm } else if constexpr (is_same_v<_Ty, long double>) { return ((LDBL_MANT_DIG - 1) + 3) / 4; } else { - static_assert(false, "Expected only double or long double here (not float)."); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected type; shouldn't be float } } diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 2580027193f..e5cc35b7700 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -2297,7 +2297,8 @@ _EXPORT_STD template , _Alloc>) { static_assert(is_constructible_v<_Ty, _Types...>, - "If uses_allocator_v, Alloc> does not hold, T must be constructible from Types..."); + "If uses_allocator_v, Alloc> is false, " + "T must be constructible from (Types...). (N4981 [allocator.uses.construction]/5)"); (void) _Al; return _STD forward_as_tuple(_STD forward<_Types>(_Args)...); } else if constexpr (is_constructible_v<_Ty, allocator_arg_t, const _Alloc&, _Types...>) { @@ -2306,8 +2307,9 @@ _NODISCARD constexpr auto uses_allocator_construction_args(const _Alloc& _Al, _T } else if constexpr (is_constructible_v<_Ty, _Types..., const _Alloc&>) { return _STD forward_as_tuple(_STD forward<_Types>(_Args)..., _Al); } else { - static_assert(false, "T must be constructible from either (allocator_arg_t, const Alloc&, Types...) " - "or (Types..., const Alloc&) if uses_allocator_v, Alloc> is true"); + static_assert(false, "If uses_allocator_v, Alloc> is true, " + "T must be constructible from either (allocator_arg_t, const Alloc&, Types...) " + "or (Types..., const Alloc&). (N4981 [allocator.uses.construction]/5)"); } } diff --git a/stl/inc/xutility b/stl/inc/xutility index f457e16014c..2863ecdbff2 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -143,7 +143,7 @@ __declspec(noalias) void _Reverse_vectorized(void* _First, void* _Last) noexcept } else if constexpr (_Nx == 8) { ::__std_reverse_trivially_swappable_8(_First, _Last); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -164,7 +164,7 @@ __declspec(noalias) size_t _Count_vectorized(_Ty* const _First, _Ty* const _Last } else if constexpr (sizeof(_Ty) == 8) { return ::__std_count_trivial_8(_First, _Last, static_cast(_Val)); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -191,7 +191,7 @@ _Ty* _Find_vectorized(_Ty* const _First, _Ty* const _Last, const _TVal _Val) noe return const_cast<_Ty*>( static_cast(::__std_find_trivial_8(_First, _Last, static_cast(_Val)))); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -212,7 +212,7 @@ _Ty* _Min_element_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { } else if constexpr (sizeof(_Ty) == 8) { return const_cast<_Ty*>(static_cast(::__std_min_element_8(_First, _Last, _Signed))); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -233,7 +233,7 @@ _Ty* _Max_element_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { } else if constexpr (sizeof(_Ty) == 8) { return const_cast<_Ty*>(static_cast(::__std_max_element_8(_First, _Last, _Signed))); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -276,7 +276,7 @@ auto _Min_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { return ::__std_min_8u(_First, _Last); } } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -319,7 +319,7 @@ auto _Max_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { return ::__std_max_8u(_First, _Last); } } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } @@ -335,7 +335,7 @@ inline size_t // TRANSITION, GH-4496 } else if constexpr (_Element_size == 8) { return __std_mismatch_8(_First1, _First2, _Count); } else { - static_assert(false, "Unexpected size"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected size } } _STD_END @@ -802,7 +802,7 @@ namespace ranges { return *static_cast<_Ty&&>(_Val); } } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -1142,7 +1142,7 @@ namespace ranges { *static_cast<_Ty1&&>(_Val1) = _Iter_swap::_Iter_exchange_move(static_cast<_Ty2&&>(_Val2), static_cast<_Ty1&&>(_Val1)); } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -2532,7 +2532,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Non_member) { return begin(_Val); // intentional ADL } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -2609,7 +2609,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Non_member) { return end(_Val); // intentional ADL } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -2745,7 +2745,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Unwrap) { return _RANGES _Unwrap_range_iter<_Ty>(_RANGES begin(_Val)); } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -2796,7 +2796,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Unwrap) { return _RANGES _Unwrap_range_sent<_Ty>(_RANGES end(_Val)); } else { - static_assert(false, "Should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -2962,7 +2962,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Make_reverse) { return _STD make_reverse_iterator(_RANGES end(_Val)); } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -3033,7 +3033,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Make_reverse) { return _STD make_reverse_iterator(_RANGES begin(_Val)); } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -3178,7 +3178,7 @@ namespace ranges { const auto _Delta = _RANGES end(_Val) - _RANGES begin(_Val); return static_cast<_Make_unsigned_like_t>>(_Delta); } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -3240,7 +3240,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Compare) { return static_cast(_RANGES begin(_Val) == _RANGES end(_Val)); } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } }; @@ -3295,7 +3295,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Address) { return _STD to_address(_RANGES begin(_Val)); } else { - static_assert(false, "should be unreachable"); + _STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy } } };