Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stl/inc/chrono
Original file line number Diff line number Diff line change
Expand Up @@ -2970,7 +2970,7 @@ namespace chrono {
void_t<decltype(_Conv1{}(_Conv2{}(_Conv3{}(_STD declval<_Tp>()))))>> = true;

template <class _DestClock, class _SourceClock, class _Duration>
_NODISCARD _CONSTEVAL _Clock_cast_strategy _Choose_clock_cast() noexcept {
_NODISCARD consteval _Clock_cast_strategy _Choose_clock_cast() noexcept {
using _Tp = const time_point<_SourceClock, _Duration>&;

if constexpr (is_invocable_v<clock_time_conversion<_DestClock, _SourceClock>, _Tp>) {
Expand Down
12 changes: 6 additions & 6 deletions stl/inc/compare
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ namespace _Strong_order {
enum class _St { _None, _Adl, _Floating, _Three };

template <class _Ty1, class _Ty2>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) {
return {_St::_None};
} else if constexpr (_Has_ADL<_Ty1, _Ty2>) {
Expand Down Expand Up @@ -486,7 +486,7 @@ namespace _Weak_order {
enum class _St { _None, _Adl, _Floating, _Three, _Strong };

template <class _Ty1, class _Ty2>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) {
return {_St::_None};
} else if constexpr (_Has_ADL<_Ty1, _Ty2>) {
Expand Down Expand Up @@ -615,7 +615,7 @@ namespace _Partial_order {
enum class _St { _None, _Adl, _Three, _Weak, _Strong };

template <class _Ty1, class _Ty2>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) {
return {_St::_None};
} else if constexpr (_Has_ADL<_Ty1, _Ty2>) {
Expand Down Expand Up @@ -684,7 +684,7 @@ namespace _Compare_strong_order_fallback {
enum class _St { _None, _Strong, _Fallback };

template <class _Ty1, class _Ty2>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) {
return {_St::_None};
} else if constexpr (_Can_strong_order<_Ty1, _Ty2>) {
Expand Down Expand Up @@ -734,7 +734,7 @@ namespace _Compare_weak_order_fallback {
enum class _St { _None, _Weak, _Fallback };

template <class _Ty1, class _Ty2>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) {
return {_St::_None};
} else if constexpr (_Can_weak_order<_Ty1, _Ty2>) {
Expand Down Expand Up @@ -791,7 +791,7 @@ namespace _Compare_partial_order_fallback {
enum class _St { _None, _Partial, _Fallback };

template <class _Ty1, class _Ty2>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) {
return {_St::_None};
} else if constexpr (_Can_partial_order<_Ty1, _Ty2>) {
Expand Down
22 changes: 11 additions & 11 deletions stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,7 @@ namespace ranges {
enum class _St { _None, _View, _Ref, _Own };

template <class _Rng>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (view<remove_cvref_t<_Rng>>) {
if constexpr (convertible_to<_Rng, remove_cvref_t<_Rng>>) {
return {_St::_View, is_nothrow_convertible_v<_Rng, remove_cvref_t<_Rng>>};
Expand Down Expand Up @@ -2026,7 +2026,7 @@ namespace ranges {
enum class _St { _None, _All, _As_rvalue };

template <class _Rng>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (same_as<range_rvalue_reference_t<_Rng>, range_reference_t<_Rng>>) {
return {_St::_All, noexcept(views::all(_STD declval<_Rng>()))};
} else if constexpr (_Can_as_rvalue<_Rng>) {
Expand Down Expand Up @@ -2967,7 +2967,7 @@ namespace ranges {
};

template <class _Rng>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
using _Ty = remove_cvref_t<_Rng>;

if constexpr (_Is_specialization_v<_Ty, empty_view>) {
Expand Down Expand Up @@ -3366,7 +3366,7 @@ namespace ranges {
};

template <class _Rng>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
using _Ty = remove_cvref_t<_Rng>;

if constexpr (_Is_specialization_v<_Ty, empty_view>) {
Expand Down Expand Up @@ -5115,7 +5115,7 @@ namespace ranges {
enum class _St { _None, _Span, _Subrange, _Subrange_counted };

template <class _It>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
using _Decayed = decay_t<_It>;
_STL_INTERNAL_STATIC_ASSERT(input_or_output_iterator<_Decayed>);
if constexpr (contiguous_iterator<_Decayed>) {
Expand Down Expand Up @@ -5244,7 +5244,7 @@ namespace ranges {
enum class _St { _None, _All, _Common };

template <class _Rng>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (common_range<_Rng>) {
return {_St::_All, noexcept(views::all(_STD declval<_Rng>()))};
} else if constexpr (copyable<iterator_t<_Rng>>) {
Expand Down Expand Up @@ -5376,7 +5376,7 @@ namespace ranges {
static_cast<int>(_Ki);

template <class _Rng>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
using _Ty = remove_cvref_t<_Rng>;

if constexpr (_Is_specialization_v<_Ty, reverse_view>) {
Expand Down Expand Up @@ -5510,7 +5510,7 @@ namespace ranges {
static constexpr bool _Can_reconstruct_ref_view_v<ref_view<_Ty>> = true;

template <class _Rng>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
using _Ty = remove_cvref_t<_Rng>;

if constexpr (constant_range<views::all_t<_Rng>>) {
Expand Down Expand Up @@ -8304,7 +8304,7 @@ namespace ranges {
};

template <bool _IsConst>
_NODISCARD static _CONSTEVAL bool _Is_end_noexcept() noexcept {
_NODISCARD static consteval bool _Is_end_noexcept() noexcept {
if constexpr (!_Zip_is_common<_Maybe_const<_IsConst, _ViewTypes>...>) {
return noexcept(_Sentinel<_IsConst>{
_Tuple_transform(_RANGES end, _STD declval<_Maybe_const<_IsConst, tuple<_ViewTypes...>>&>())});
Expand Down Expand Up @@ -8396,7 +8396,7 @@ namespace ranges {
struct _Zip_fn {
private:
template <class... _Types>
_NODISCARD static _CONSTEVAL bool _Is_invocation_noexcept() {
_NODISCARD static consteval bool _Is_invocation_noexcept() {
if constexpr (sizeof...(_Types) == 0) {
// NOTE: views::empty<tuple<>> is nothrow copy-constructible.
return true;
Expand Down Expand Up @@ -8666,7 +8666,7 @@ namespace ranges {
};

template <bool _IsConst>
_NODISCARD static _CONSTEVAL bool _Is_end_noexcept() noexcept {
_NODISCARD static consteval bool _Is_end_noexcept() noexcept {
if constexpr (common_range<_Maybe_const<_IsConst, _Inner_view>>) {
return noexcept(_Iterator<_IsConst>{_STD declval<_Maybe_const<_IsConst, zip_transform_view>&>(),
_STD declval<_Maybe_const<_IsConst, _Inner_view>&>().end()});
Expand Down
8 changes: 4 additions & 4 deletions stl/inc/source_location
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#define _SOURCE_LOCATION_
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#ifndef __cpp_consteval
_EMIT_STL_WARNING(STL4038, "The contents of <source_location> are available only with C++20 consteval support.");
#else // ^^^ !defined(__cpp_consteval) / defined(__cpp_consteval) vvv
#if !_HAS_CXX20
_EMIT_STL_WARNING(STL4038, "The contents of <source_location> are available only with C++20 or later.");
#else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv

#include <cstdint>

Expand Down Expand Up @@ -66,6 +66,6 @@ _STD_END
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#endif // !defined(__cpp_consteval)
#endif // _HAS_CXX20
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _SOURCE_LOCATION_
4 changes: 2 additions & 2 deletions stl/inc/utility
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ _NODISCARD constexpr bool cmp_greater_equal(const _Ty1 _Left, const _Ty2 _Right)
}

template <class _Ty>
_NODISCARD _CONSTEVAL _Ty _Min_limit() noexcept { // same as (numeric_limits<_Ty>::min)(), less throughput cost
_NODISCARD consteval _Ty _Min_limit() noexcept { // same as (numeric_limits<_Ty>::min)(), less throughput cost
static_assert(_Is_standard_integer<_Ty>); // doesn't attempt to handle all types
if constexpr (is_signed_v<_Ty>) {
constexpr auto _Unsigned_max = static_cast<make_unsigned_t<_Ty>>(-1);
Expand All @@ -859,7 +859,7 @@ _NODISCARD _CONSTEVAL _Ty _Min_limit() noexcept { // same as (numeric_limits<_Ty
}

template <class _Ty>
_NODISCARD _CONSTEVAL _Ty _Max_limit() noexcept { // same as (numeric_limits<_Ty>::max)(), less throughput cost
_NODISCARD consteval _Ty _Max_limit() noexcept { // same as (numeric_limits<_Ty>::max)(), less throughput cost
static_assert(_Is_standard_integer<_Ty>); // doesn't attempt to handle all types
if constexpr (is_signed_v<_Ty>) {
constexpr auto _Unsigned_max = static_cast<make_unsigned_t<_Ty>>(-1);
Expand Down
24 changes: 12 additions & 12 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ namespace ranges {
enum class _St { _None, _Custom, _Fallback };

template <class _Ty>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (_Has_ADL<_Ty>) {
return {_St::_Custom, noexcept(iter_move(_STD declval<_Ty>()))}; // intentional ADL
} else if constexpr (_Can_deref<_Ty>) {
Expand Down Expand Up @@ -770,7 +770,7 @@ namespace ranges {
enum class _St { _None, _Custom, _Swap, _Exchange };

template <class _Ty1, class _Ty2>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
if constexpr (_Has_ADL<_Ty1, _Ty2>) {
return {_St::_Custom,
noexcept(iter_swap(_STD declval<_Ty1>(), _STD declval<_Ty2>()))}; // intentional ADL
Expand Down Expand Up @@ -1833,7 +1833,7 @@ private:
using _Reference = iter_const_reference_t<_Iter>;
using _Rvalue_reference = _Iter_const_rvalue_reference_t<_Iter>;

_NODISCARD static _CONSTEVAL auto _Get_iter_concept() noexcept {
_NODISCARD static consteval auto _Get_iter_concept() noexcept {
if constexpr (contiguous_iterator<_Iter>) {
return contiguous_iterator_tag{};
} else if constexpr (random_access_iterator<_Iter>) {
Expand Down Expand Up @@ -2155,7 +2155,7 @@ namespace ranges {
enum class _St { _None, _Array, _Member, _Non_member };

template <class _Ty>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
_STL_INTERNAL_STATIC_ASSERT(is_lvalue_reference_v<_Ty>);
if constexpr (is_array_v<remove_reference_t<_Ty>>) {
static_assert(_Has_complete_elements<_Ty>,
Expand Down Expand Up @@ -2224,7 +2224,7 @@ namespace ranges {
enum class _St { _None, _Array, _Member, _Non_member };

template <class _Ty>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
_STL_INTERNAL_STATIC_ASSERT(is_lvalue_reference_v<_Ty>);
using _UnRef = remove_reference_t<_Ty>;

Expand Down Expand Up @@ -2371,7 +2371,7 @@ namespace ranges {
enum class _St { _None, _Member, _Unwrap };

template <class _Ty>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
_STL_INTERNAL_STATIC_ASSERT(is_lvalue_reference_v<_Ty>);
if constexpr (_Has_member<_Ty>) {
_STL_INTERNAL_STATIC_ASSERT(
Expand Down Expand Up @@ -2425,7 +2425,7 @@ namespace ranges {
enum class _St { _None, _Member, _Unwrap };

template <class _Ty>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
_STL_INTERNAL_STATIC_ASSERT(is_lvalue_reference_v<_Ty>);
if constexpr (_Has_member<_Ty>) {
return {_St::_Member, noexcept(_STD declval<_Ty>()._Unchecked_end())};
Expand Down Expand Up @@ -2590,7 +2590,7 @@ namespace ranges {
enum class _St { _None, _Member, _Non_member, _Make_reverse };

template <class _Ty>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
_STL_INTERNAL_STATIC_ASSERT(is_lvalue_reference_v<_Ty>);
if constexpr (_Has_member<_Ty>) {
return {_St::_Member, noexcept(_Fake_copy_init(_STD declval<_Ty>().rbegin()))};
Expand Down Expand Up @@ -2660,7 +2660,7 @@ namespace ranges {
enum class _St { _None, _Member, _Non_member, _Make_reverse };

template <class _Ty>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
_STL_INTERNAL_STATIC_ASSERT(is_lvalue_reference_v<_Ty>);
if constexpr (_Has_member<_Ty>) {
return {_St::_Member, noexcept(_Fake_copy_init(_STD declval<_Ty>().rend()))};
Expand Down Expand Up @@ -2799,7 +2799,7 @@ namespace ranges {
enum class _St { _None, _Array, _Member, _Non_member, _Subtract };

template <class _Ty>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
_STL_INTERNAL_STATIC_ASSERT(is_lvalue_reference_v<_Ty>);
using _UnCV = remove_cvref_t<_Ty>;

Expand Down Expand Up @@ -2869,7 +2869,7 @@ namespace ranges {
enum class _St { _None, _Member, _Size, _Compare };

template <class _Ty>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
_STL_INTERNAL_STATIC_ASSERT(is_lvalue_reference_v<_Ty>);
if constexpr (is_unbounded_array_v<remove_reference_t<_Ty>>) {
return {_St::_None};
Expand Down Expand Up @@ -2933,7 +2933,7 @@ namespace ranges {
enum class _St { _None, _Member, _Address };

template <class _Ty>
_NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept {
_NODISCARD static consteval _Choice_t<_St> _Choose() noexcept {
_STL_INTERNAL_STATIC_ASSERT(is_lvalue_reference_v<_Ty>);
if constexpr (_Has_member<_Ty>) {
return {_St::_Member, noexcept(_STD declval<_Ty>().data())};
Expand Down
14 changes: 5 additions & 9 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1671,15 +1671,11 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect
#define __cpp_lib_remove_cvref 201711L
#define __cpp_lib_semaphore 201907L
#define __cpp_lib_smart_ptr_for_overwrite 202002L

#ifdef __cpp_consteval
#define __cpp_lib_source_location 201907L
#endif // __cpp_consteval

#define __cpp_lib_span 202002L
#define __cpp_lib_ssize 201902L
#define __cpp_lib_starts_ends_with 201711L
#define __cpp_lib_syncbuf 201803L
#define __cpp_lib_source_location 201907L
#define __cpp_lib_span 202002L
#define __cpp_lib_ssize 201902L
#define __cpp_lib_starts_ends_with 201711L
#define __cpp_lib_syncbuf 201803L

#ifdef __cpp_lib_concepts
#define __cpp_lib_three_way_comparison 201907L
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/P1208R6_source_location/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ constexpr void header_test() {
using namespace std;
const auto x = source_location::current();
assert(x.line() == __LINE__ - 1);
#ifdef __clang__
assert(x.column() == 20);
#else // ^^^ defined(__clang__) / !defined(__clang__) vvv
assert(x.column() == 37);
#endif // ^^^ !defined(__clang__) ^^^
#if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-10199227 and LLVM-58951
assert(x.function_name() == "header_test"sv);
#else // ^^^ workaround / no workaround vvv
Expand Down
Loading