diff --git a/stl/inc/algorithm b/stl/inc/algorithm index df17fea0db..6ba8bb4df3 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -93,7 +93,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(_Always_false>, "Unexpected size"); + static_assert(false, "Unexpected size"); } } @@ -116,7 +116,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(_Always_false<_Ty>, "Unexpected size"); + static_assert(false, "Unexpected size"); } return {const_cast<_Ty*>(static_cast(_Res._Min)), const_cast<_Ty*>(static_cast(_Res._Max))}; @@ -162,7 +162,7 @@ auto _Minmax_vectorized(_Ty* const _First, _Ty* const _Last) noexcept { return ::__std_minmax_8u(_First, _Last); } } else { - static_assert(_Always_false<_Ty>, "Unexpected size"); + static_assert(false, "Unexpected size"); } } @@ -189,7 +189,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(_Always_false<_Ty>, "Unexpected size"); + static_assert(false, "Unexpected size"); } } @@ -203,7 +203,7 @@ _Ty1* _Find_first_of_vectorized( return const_cast<_Ty1*>( static_cast(::__std_find_first_of_trivial_2(_First1, _Last1, _First2, _Last2))); } else { - static_assert(_Always_false<_Ty1>, "Unexpected size"); + static_assert(false, "Unexpected size"); } } @@ -221,7 +221,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(_Always_false<_Ty>, "Unexpected size"); + static_assert(false, "Unexpected size"); } } diff --git a/stl/inc/bit b/stl/inc/bit index ca62fadab6..664621ee89 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(_Always_false<_Ty>, "Unexpected integer size"); + static_assert(false, "Unexpected integer size"); } } #endif // _HAS_CXX23 diff --git a/stl/inc/chrono b/stl/inc/chrono index 58c711194a..ffbfeeca18 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -3030,15 +3030,14 @@ namespace chrono { clock_time_conversion{}( clock_time_conversion{}(_Time))); } else if constexpr (_Strat == _Clock_cast_strategy::_Two_step_ambiguous) { - static_assert(_Always_false<_Duration>, + static_assert(false, "A two-step clock time conversion is required to be unique, " "either through utc_clock or system_clock, but not both (N4950 [time.clock.cast.fn]/2)."); } else if constexpr (_Strat == _Clock_cast_strategy::_Three_step_ambiguous) { - static_assert(_Always_false<_Duration>, - "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)."); + 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(_Always_false<_Duration>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } @@ -5388,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(_Always_false<_Ty>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } diff --git a/stl/inc/compare b/stl/inc/compare index 22f7509089..877eb67f1f 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(_Always_false<_Ty1>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -579,7 +579,7 @@ namespace _Weak_order { return static_cast( static_cast(strong_order(_Left, _Right))); // intentional ADL } else { - static_assert(_Always_false<_Ty1>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -664,7 +664,7 @@ namespace _Partial_order { return static_cast( static_cast(strong_order(_Left, _Right))); // intentional ADL } else { - static_assert(_Always_false<_Ty1>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -720,7 +720,7 @@ namespace _Compare_strong_order_fallback { : _Left < _Right ? strong_ordering::less : strong_ordering::greater; } else { - static_assert(_Always_false<_Ty1>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -770,7 +770,7 @@ namespace _Compare_weak_order_fallback { : _Left < _Right ? weak_ordering::less : weak_ordering::greater; } else { - static_assert(_Always_false<_Ty1>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -829,7 +829,7 @@ namespace _Compare_partial_order_fallback { : _Right < _Left ? partial_ordering::greater : partial_ordering::unordered; } else { - static_assert(_Always_false<_Ty1>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; diff --git a/stl/inc/experimental/generator b/stl/inc/experimental/generator index f6fea9c47c..fb39c703c2 100644 --- a/stl/inc/experimental/generator +++ b/stl/inc/experimental/generator @@ -79,8 +79,7 @@ namespace experimental { template _Uty&& await_transform(_Uty&& _Whatever) { - static_assert(_Always_false<_Uty>, - "co_await is not supported in coroutines of type std::experimental::generator"); + static_assert(false, "co_await is not supported in coroutines of type std::experimental::generator"); return _STD forward<_Uty>(_Whatever); } diff --git a/stl/inc/functional b/stl/inc/functional index a9b23ab633..6d2d9c21f0 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -1621,12 +1621,10 @@ public: template class _Move_only_function_call { - static_assert((_Always_false<_Signature> || ...), + static_assert(_Always_false>, "std::move_only_function only accepts function types as template arguments, " - "with possibly const/ref/noexcept qualifiers."); - - static_assert(sizeof...(_Signature) > 0, - "Unlike std::function, std::move_only_function does not define class template argument deduction guides."); + "with possibly const/ref/noexcept qualifiers. Also, unlike std::function, " + "std::move_only_function does not define class template argument deduction guides."); }; // A script to generate the specializations is at @@ -2607,7 +2605,7 @@ public: } else if constexpr (_Del == _Deletion_kind::_Normal_array) { delete[] _Ptr; } else { - static_assert(_Always_false<_Ty>, "Unknown _Deletion_kind."); + static_assert(false, "Unknown _Deletion_kind."); } } } diff --git a/stl/inc/ranges b/stl/inc/ranges index 1407c82e45..d639701ec7 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(_Always_false<_Rng>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } } }; @@ -2164,7 +2164,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_As_rvalue) { return as_rvalue_view{_STD forward<_Rng>(_Range)}; } else { - static_assert(_Always_false<_Rng>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } } }; @@ -3142,7 +3142,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Reconstruct_subrange) { return subrange(_First, _First + _Count); } else { - static_assert(_Always_false<_Rng>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } } } @@ -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(_Always_false<_Rng>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } } } @@ -5389,7 +5389,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Common) { return common_view{_STD forward<_Rng>(_Range)}; } else { - static_assert(_Always_false<_Rng>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } } }; @@ -5548,7 +5548,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Reverse) { return reverse_view{_STD forward<_Rng>(_Range)}; } else { - static_assert(_Always_false<_Rng>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } } }; @@ -5692,7 +5692,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_As_const) { return as_const_view{_STD forward<_Rng>(_Range)}; } else { - static_assert(_Always_false<_Rng>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } } }; @@ -10369,7 +10369,7 @@ namespace ranges { }; return _RANGES to<_Container>(views::transform(ref_view{_Range}, _Xform), _STD forward<_Types>(_Args)...); } else { - static_assert(_Always_false<_Container>, "the program is ill-formed per N4950 [range.utility.conv.to]/2.3"); + static_assert(false, "the program is ill-formed per N4950 [range.utility.conv.to]/2.3"); } } diff --git a/stl/inc/tuple b/stl/inc/tuple index 5571a7e162..faafeb4451 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(_Always_false<_Ty>, - "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(_Always_false<_Ty>, - "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(_Always_false<_Ty>, - "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(_Always_false<_Ty>, - "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/type_traits b/stl/inc/type_traits index 43e2ca6a37..c81bc205c8 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -28,8 +28,7 @@ _STL_DISABLE_CLANG_WARNINGS _STD_BEGIN template -// TRANSITION, CWG-2518: false value attached to a dependent name (for static_assert) -constexpr bool _Always_false = false; +constexpr bool _Always_false = false; // TRANSITION, VSO-2016422 (EDG) template struct _Conjunction { // handle false trait or last trait @@ -129,7 +128,7 @@ using add_rvalue_reference_t = typename _Add_reference<_Ty>::_Rvalue; _EXPORT_STD template add_rvalue_reference_t<_Ty> declval() noexcept { - static_assert(_Always_false<_Ty>, "Calling declval is ill-formed, see N4950 [declval]/2."); + static_assert(false, "Calling declval is ill-formed, see N4950 [declval]/2."); } _EXPORT_STD template diff --git a/stl/inc/variant b/stl/inc/variant index 4b8060c76c..d6c3383dca 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -1143,8 +1143,8 @@ _NODISCARD constexpr bool holds_alternative(const variant<_Types...>& _Var) noex if constexpr (_Idx != _Meta_npos) { return _Var.index() == _Idx; } else { - static_assert(_Always_false<_Ty>, "holds_alternative(const variant&) requires T to occur exactly " - "once in Types. (N4971 [variant.get]/1)"); + static_assert(false, "holds_alternative(const variant&) requires T to occur exactly " + "once in Types. (N4971 [variant.get]/1)"); } } @@ -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(_Always_false<_Ty>, - "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(_Always_false<_Ty>, - "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,7 +1218,7 @@ _NODISCARD constexpr decltype(auto) get(const variant<_Types...>& _Var) { if constexpr (_Idx < sizeof...(_Types)) { return _STD get<_Idx>(_Var); } else { - static_assert(_Always_false<_Ty>, + static_assert(false, "get(const variant&) requires T to occur exactly once in Types. (N4971 [variant.get]/8)"); } } @@ -1229,7 +1229,7 @@ _NODISCARD constexpr decltype(auto) get(const variant<_Types...>&& _Var) { if constexpr (_Idx < sizeof...(_Types)) { return _STD get<_Idx>(_STD move(_Var)); } else { - static_assert(_Always_false<_Ty>, + static_assert(false, "get(const variant&&) requires T to occur exactly once in Types. (N4971 [variant.get]/8)"); } } @@ -1254,7 +1254,7 @@ _NODISCARD constexpr add_pointer_t<_Ty> get_if(variant<_Types...>* _Ptr) noexcep if constexpr (_Idx != _Meta_npos) { return _STD get_if<_Idx>(_Ptr); } else { - static_assert(_Always_false<_Ty>, + static_assert(false, "get_if(variant *) requires T to occur exactly once in Types. (N4971 [variant.get]/12)"); } } @@ -1265,7 +1265,7 @@ _NODISCARD constexpr add_pointer_t get_if(const variant<_Types...>* _ if constexpr (_Idx != _Meta_npos) { return _STD get_if<_Idx>(_Ptr); } else { - static_assert(_Always_false<_Ty>, + static_assert(false, "get_if(const variant *) requires T to occur exactly once in Types. (N4971 [variant.get]/12)"); } } diff --git a/stl/inc/vector b/stl/inc/vector index 9cfe2530e2..c57c0f0fec 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(_Always_false<_Ty>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } _ASAN_VECTOR_CREATE; _Guard._Target = nullptr; diff --git a/stl/inc/xlocnum b/stl/inc/xlocnum index 8b39602ea8..2bba517184 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(_Always_false<_Ty>, "Expected only double or long double here (not float)."); + static_assert(false, "Expected only double or long double here (not float)."); } } diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 57cce6685c..2580027193 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -2306,9 +2306,8 @@ _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(_Always_false<_Ty>, - "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, "T must be constructible from either (allocator_arg_t, const Alloc&, Types...) " + "or (Types..., const Alloc&) if uses_allocator_v, Alloc> is true"); } } diff --git a/stl/inc/xutility b/stl/inc/xutility index a58ccea242..f457e16014 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(_Always_false>, "Unexpected size"); + 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(_Always_false<_Ty>, "Unexpected size"); + 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(_Always_false<_Ty>, "Unexpected size"); + 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(_Always_false<_Ty>, "Unexpected size"); + 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(_Always_false<_Ty>, "Unexpected size"); + 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(_Always_false<_Ty>, "Unexpected size"); + 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(_Always_false<_Ty>, "Unexpected size"); + 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(_Always_false>, "Unexpected size"); + static_assert(false, "Unexpected size"); } } _STD_END @@ -802,7 +802,7 @@ namespace ranges { return *static_cast<_Ty&&>(_Val); } } else { - static_assert(_Always_false<_Ty>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -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(_Always_false<_Ty1>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -2532,7 +2532,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Non_member) { return begin(_Val); // intentional ADL } else { - static_assert(_Always_false<_Ty>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } } }; @@ -2609,7 +2609,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Non_member) { return end(_Val); // intentional ADL } else { - static_assert(_Always_false<_Ty>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -2745,7 +2745,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Unwrap) { return _RANGES _Unwrap_range_iter<_Ty>(_RANGES begin(_Val)); } else { - static_assert(_Always_false<_Ty>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } } }; @@ -2796,7 +2796,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Unwrap) { return _RANGES _Unwrap_range_sent<_Ty>(_RANGES end(_Val)); } else { - static_assert(_Always_false<_Ty>, "Should be unreachable"); + static_assert(false, "Should be unreachable"); } } }; @@ -2962,7 +2962,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Make_reverse) { return _STD make_reverse_iterator(_RANGES end(_Val)); } else { - static_assert(_Always_false<_Ty>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -3033,7 +3033,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Make_reverse) { return _STD make_reverse_iterator(_RANGES begin(_Val)); } else { - static_assert(_Always_false<_Ty>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -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(_Always_false<_Ty>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -3240,7 +3240,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Compare) { return static_cast(_RANGES begin(_Val) == _RANGES end(_Val)); } else { - static_assert(_Always_false<_Ty>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; @@ -3295,7 +3295,7 @@ namespace ranges { } else if constexpr (_Strat == _St::_Address) { return _STD to_address(_RANGES begin(_Val)); } else { - static_assert(_Always_false<_Ty>, "should be unreachable"); + static_assert(false, "should be unreachable"); } } }; diff --git a/tests/std/include/range_algorithm_support.hpp b/tests/std/include/range_algorithm_support.hpp index 52a1d947ec..d6fdd30d45 100644 --- a/tests/std/include/range_algorithm_support.hpp +++ b/tests/std/include/range_algorithm_support.hpp @@ -17,7 +17,7 @@ namespace ranges = std::ranges; template -constexpr bool always_false = false; +constexpr bool always_false = false; // TRANSITION, VSO-2016422 (EDG) template constexpr T* nullptr_to = nullptr; @@ -67,12 +67,12 @@ namespace test { template void operator&(T&&) { - static_assert(always_false); + static_assert(false); } template void operator,(T&&, U&&) { - static_assert(always_false); + static_assert(false); } enum class CanDifference : bool { no, yes }; @@ -490,29 +490,29 @@ namespace test { } auto operator--() & { - static_assert(always_false); + static_assert(false); } auto operator--(int) & { - static_assert(always_false); + static_assert(false); } friend void iter_swap(iterator const&, iterator const&) requires std::is_same_v { - static_assert(always_false); + static_assert(false); } void operator<(iterator const&) const { - static_assert(always_false); + static_assert(false); } void operator>(iterator const&) const { - static_assert(always_false); + static_assert(false); } void operator<=(iterator const&) const { - static_assert(always_false); + static_assert(false); } void operator>=(iterator const&) const { - static_assert(always_false); + static_assert(false); } // input iterator operations: @@ -926,11 +926,11 @@ namespace test { } void operator&() const { - static_assert(always_false); + static_assert(false); } template friend void operator,(range const&, T&&) { - static_assert(always_false); + static_assert(false); } }; } // namespace test diff --git a/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp b/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp index 64e3e9d2cf..94008bd066 100644 --- a/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp +++ b/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp @@ -32,9 +32,6 @@ using namespace std; // underlying sequence. However, value-initialized iterators may be compared and // shall compare equal to other value-initialized iterators of the same type." -template -struct always_false : false_type {}; - // Note we take the iterators under test by const& to avoid invoking copy constructors // which may invalidate the "placement new on top of garbage" test case. template diff --git a/tests/std/tests/GH_003570_allocate_at_least/test.cpp b/tests/std/tests/GH_003570_allocate_at_least/test.cpp index 37408cf478..c6f5338b52 100644 --- a/tests/std/tests/GH_003570_allocate_at_least/test.cpp +++ b/tests/std/tests/GH_003570_allocate_at_least/test.cpp @@ -102,9 +102,6 @@ void test_syncstream() { test_stream_overflow(ss); } -template -constexpr bool always_false = false; - template struct icky_allocator : allocator { template @@ -118,7 +115,7 @@ struct icky_allocator : allocator { // call allocate_at_least in the std::allocator base (which would then call std::allocator::allocate), // and would then call deallocate in the derived class (hiding the base implementation), a terrible mismatch. // We now detect public derivation from std::allocator and avoid using allocate_at_least in that case. - static_assert(always_false); + static_assert(false); } }; diff --git a/tests/std/tests/P0896R4_ranges_iterator_machinery/test.cpp b/tests/std/tests/P0896R4_ranges_iterator_machinery/test.cpp index f498f66f2e..919d5e26c9 100644 --- a/tests/std/tests/P0896R4_ranges_iterator_machinery/test.cpp +++ b/tests/std/tests/P0896R4_ranges_iterator_machinery/test.cpp @@ -1278,7 +1278,7 @@ namespace iterator_cust_swap_test { }; template void iter_swap(T&, U&) { // this function is unordered with the poison pill - static_assert(always_false); + static_assert(false); } // clang-format off @@ -1872,7 +1872,7 @@ namespace unreachable_sentinel_test { template auto operator-(T const&) const { - static_assert(always_false, "Don't instantiate me!"); + static_assert(false, "Don't instantiate me!"); } }; diff --git a/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp b/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp index a225dff294..40d4d320f4 100644 --- a/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp +++ b/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp @@ -1255,23 +1255,23 @@ namespace adl_block { // Validate some range concept corner cases struct prefer_member : members_only {}; template int* begin(prefer_member&) { - static_assert(always_false); + static_assert(false); } template int* end(prefer_member&) { - static_assert(always_false); + static_assert(false); } template std::reverse_iterator rbegin(prefer_member&) { - static_assert(always_false); + static_assert(false); } template std::reverse_iterator rend(prefer_member&) { - static_assert(always_false); + static_assert(false); } template int* data(prefer_member&) { - static_assert(always_false); + static_assert(false); } constexpr bool test() { @@ -1706,11 +1706,11 @@ struct badsized_range : Base { // size() launches the missiles. badsized_range& operator=(badsized_range&&) = default; [[noreturn]] int size() const { - static_assert(always_false); + static_assert(false); } [[noreturn]] friend int size(const badsized_range&) { - static_assert(always_false); + static_assert(false); } }; diff --git a/tests/std/tests/P0896R4_views_single/test.cpp b/tests/std/tests/P0896R4_views_single/test.cpp index ccf315b8d2..4979d518c1 100644 --- a/tests/std/tests/P0896R4_views_single/test.cpp +++ b/tests/std/tests/P0896R4_views_single/test.cpp @@ -10,9 +10,6 @@ using namespace std; -template -constexpr bool always_false = false; - struct only_copy_constructible { int val; @@ -24,12 +21,12 @@ struct only_copy_constructible { template auto operator&() const { - static_assert(always_false); + static_assert(false); } template auto operator,(U&&) const { - static_assert(always_false); + static_assert(false); } }; diff --git a/tests/std/tests/P0898R3_concepts/test.cpp b/tests/std/tests/P0898R3_concepts/test.cpp index 4f596a26d4..aed3167f2e 100644 --- a/tests/std/tests/P0898R3_concepts/test.cpp +++ b/tests/std/tests/P0898R3_concepts/test.cpp @@ -30,7 +30,7 @@ template constexpr bool is_trait> = true; template -constexpr bool always_false = false; +constexpr bool always_false = false; // TRANSITION, VSO-2016422 (EDG) struct IncompleteClass; union IncompleteUnion; diff --git a/tests/std/tests/VSO_0000000_fancy_pointers/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_fancy_pointers/test.compile.pass.cpp index 541b9a3f2f..052da00994 100644 --- a/tests/std/tests/VSO_0000000_fancy_pointers/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_fancy_pointers/test.compile.pass.cpp @@ -24,9 +24,6 @@ #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) -template -struct always_false : std::false_type {}; - template class fancy_pointer { public: @@ -84,7 +81,7 @@ class fancy_pointer { } fancy_pointer operator++(int) { - static_assert(always_false::value, "avoid postincrement"); + static_assert(false, "avoid postincrement"); fancy_pointer result = *this; ++rep; return result; @@ -96,7 +93,7 @@ class fancy_pointer { } fancy_pointer operator--(int) { - static_assert(always_false::value, "avoid postdecrement"); + static_assert(false, "avoid postdecrement"); fancy_pointer result = *this; --rep; return result; @@ -334,7 +331,7 @@ struct fancy_allocator { template void construct(const fancy_pointer&, Args&&...) { // note: static_assert rather than =delete because we want allocator_traits to think we provide this - static_assert(always_false::value, "construct takes unfancy pointer"); + static_assert(false, "construct takes unfancy pointer"); } template @@ -344,7 +341,7 @@ struct fancy_allocator { template void destroy(const fancy_pointer&) { - static_assert(always_false::value, "destroy takes unfancy pointer"); + static_assert(false, "destroy takes unfancy pointer"); } // default select_on_container_copy_construction diff --git a/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp b/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp index 0674239e15..c1f4584903 100644 --- a/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp +++ b/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp @@ -643,9 +643,6 @@ void test_VSO_191303() { // VSO-215996 ": Wrong tuple constructor overload resolution causes stack overflow" // VSO-216014 ": Tuple constructor overload resolution error" -template -struct AlwaysFalse : false_type {}; - // AbsorbingRef and AbsorbingVal need to appear to be omni-constructible, // so they use static_assert instead of =delete. @@ -656,7 +653,7 @@ struct AbsorbingRef { template AbsorbingRef(const T&) { - STATIC_ASSERT(AlwaysFalse::value); + STATIC_ASSERT(false); } }; @@ -667,7 +664,7 @@ struct AbsorbingVal { template AbsorbingVal(U) { - STATIC_ASSERT(AlwaysFalse::value); + STATIC_ASSERT(false); } };