diff --git a/libcxx/docs/Status/Cxx2cIssues.csv b/libcxx/docs/Status/Cxx2cIssues.csv index c6225127a74b9..5460664369793 100644 --- a/libcxx/docs/Status/Cxx2cIssues.csv +++ b/libcxx/docs/Status/Cxx2cIssues.csv @@ -132,7 +132,7 @@ "`LWG4200 `__","The ``operation_state`` concept can be simplified","2025-06 (Sofia)","","","" "`LWG4201 `__","``with-await-transform::await_transform`` should not use a deduced return type","2025-06 (Sofia)","","","" "`LWG4217 `__","Clarify ``mdspan`` layout mapping requirements for ``rank == 0``","2025-06 (Sofia)","","","" -"`LWG4222 `__","``expected`` constructor from a single value missing a constraint","2025-06 (Sofia)","","","" +"`LWG4222 `__","``expected`` constructor from a single value missing a constraint","2025-06 (Sofia)","|Complete|","22","" "`LWG4224 `__","Philox engines should be freestanding","2025-06 (Sofia)","","","" "`LWG4227 `__","Missing ``noexcept`` operator in [exec.when.all]","2025-06 (Sofia)","","","" "`LWG4231 `__","``datapar::chunk`` should use ``simd-size-type`` instead of ``size_t``","2025-06 (Sofia)","","","" diff --git a/libcxx/include/__expected/expected.h b/libcxx/include/__expected/expected.h index 0f446b870723b..38a34121040f6 100644 --- a/libcxx/include/__expected/expected.h +++ b/libcxx/include/__expected/expected.h @@ -557,7 +557,8 @@ class expected : private __expected_base<_Tp, _Err> { template requires(!is_same_v, in_place_t> && !is_same_v> && - is_constructible_v<_Tp, _Up> && !__is_std_unexpected>::value && + !is_same_v, unexpect_t> && is_constructible_v<_Tp, _Up> && + !__is_std_unexpected>::value && (!is_same_v, bool> || !__is_std_expected>::value)) _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp>) expected(_Up&& __u) noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened diff --git a/libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.u.pass.cpp b/libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.u.pass.cpp index fa9f5a115ccf5..13c0da27bc533 100644 --- a/libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.u.pass.cpp +++ b/libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.u.pass.cpp @@ -14,6 +14,7 @@ // Constraints: // - is_same_v, in_place_t> is false; and // - is_same_v> is false; and +// - is_same_v, unexpect_t> is false; and // - remove_cvref_t is not a specialization of unexpected; and // - is_constructible_v is true. // @@ -46,6 +47,16 @@ static_assert(!std::is_constructible_v, std: // Note that result is true because it is covered by the constructors that take expected static_assert(std::is_constructible_v, std::expected&>); +struct T { + explicit T(auto) {} +}; +struct E { + E(int) {} +}; + +// is_same_v, unexpect_t> is false; +static_assert(!std::is_constructible_v, std::unexpect_t>); + // remove_cvref_t is a specialization of unexpected // Note that result is true because it is covered by the constructors that take unexpected static_assert(std::is_constructible_v, std::unexpected&>);