diff --git a/libcxx/include/__expected/expected.h b/libcxx/include/__expected/expected.h --- a/libcxx/include/__expected/expected.h +++ b/libcxx/include/__expected/expected.h @@ -76,19 +76,14 @@ template class expected { - static_assert( - !is_reference_v<_Tp> && - !is_function_v<_Tp> && - !is_same_v, in_place_t> && - !is_same_v, unexpect_t> && - !__unexpected::__is_unexpected>::value && - __unexpected::__valid_unexpected<_Err>::value - , - "[expected.object.general] A program that instantiates the definition of template expected for a " - "reference type, a function type, or for possibly cv-qualified types in_place_t, unexpect_t, or a " - "specialization of unexpected for the T parameter is ill-formed. A program that instantiates the " - "definition of the template expected with a type for the E parameter that is not a valid " - "template argument for unexpected is ill-formed."); + static_assert(!is_reference_v<_Tp> && !is_function_v<_Tp> && !is_same_v, in_place_t> && + !is_same_v, unexpect_t> && !__is_std_unexpected>::value && + __valid_std_unexpected<_Err>::value, + "[expected.object.general] A program that instantiates the definition of template expected for a " + "reference type, a function type, or for possibly cv-qualified types in_place_t, unexpect_t, or a " + "specialization of unexpected for the T parameter is ill-formed. A program that instantiates the " + "definition of the template expected with a type for the E parameter that is not a valid " + "template argument for unexpected is ill-formed."); template friend class expected; @@ -198,7 +193,7 @@ template requires(!is_same_v, in_place_t> && !is_same_v> && - !__unexpected::__is_unexpected>::value && is_constructible_v<_Tp, _Up>) + !__is_std_unexpected>::value && is_constructible_v<_Tp, _Up>) _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp>) expected(_Up&& __u) noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened @@ -356,12 +351,9 @@ template _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(_Up&& __v) - requires(!is_same_v> && - !__unexpected::__is_unexpected>::value && - is_constructible_v<_Tp, _Up> && - is_assignable_v<_Tp&, _Up> && - (is_nothrow_constructible_v<_Tp, _Up> || - is_nothrow_move_constructible_v<_Tp> || + requires(!is_same_v> && !__is_std_unexpected>::value && + is_constructible_v<_Tp, _Up> && is_assignable_v<_Tp&, _Up> && + (is_nothrow_constructible_v<_Tp, _Up> || is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>)) { if (__has_val_) { @@ -646,7 +638,7 @@ template requires is_void_v<_Tp> class expected<_Tp, _Err> { - static_assert(__unexpected::__valid_unexpected<_Err>::value, + static_assert(__valid_std_unexpected<_Err>::value, "[expected.void.general] A program that instantiates expected with a E that is not a " "valid argument for unexpected is ill-formed"); diff --git a/libcxx/include/__expected/unexpected.h b/libcxx/include/__expected/unexpected.h --- a/libcxx/include/__expected/unexpected.h +++ b/libcxx/include/__expected/unexpected.h @@ -38,28 +38,24 @@ template class unexpected; -namespace __unexpected { - template -struct __is_unexpected : false_type {}; +struct __is_std_unexpected : false_type {}; template -struct __is_unexpected> : true_type {}; +struct __is_std_unexpected> : true_type {}; template -using __valid_unexpected = _BoolConstant< // - is_object_v<_Tp> && // - !is_array_v<_Tp> && // - !__is_unexpected<_Tp>::value && // - !is_const_v<_Tp> && // - !is_volatile_v<_Tp> // +using __valid_std_unexpected = _BoolConstant< // + is_object_v<_Tp> && // + !is_array_v<_Tp> && // + !__is_std_unexpected<_Tp>::value && // + !is_const_v<_Tp> && // + !is_volatile_v<_Tp> // >; -} // namespace __unexpected - template class unexpected { - static_assert(__unexpected::__valid_unexpected<_Err>::value, + static_assert(__valid_std_unexpected<_Err>::value, "[expected.un.general] states a program that instantiates std::unexpected for a non-object type, an " "array type, a specialization of unexpected, or a cv-qualified type is ill-formed.");