[libcxx-commits] [libcxx] [libc++] Avoid using **this to access the value stored in std::expected (PR #84840)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 18 07:21:52 PDT 2024
================
@@ -920,9 +920,9 @@ class expected : private __expected_base<_Tp, _Err> {
requires is_constructible_v<_Err, _Err&>
_LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&>>;
- static_assert(__is_std_expected<_Up>::value, "The result of f(**this) must be a specialization of std::expected");
+ static_assert(__is_std_expected<_Up>::value, "The result of f(value()) must be a specialization of std::expected");
----------------
yronglin wrote:
Yeah, I think so. Since https://reviews.llvm.org/D154116 we have addressed LWG3973's std::expected part. This PR improves static_assert message. `__val` seems more closely to the LWG wording. Using `__val()` may requires the user to understand implementation details(e.g. __expected_base). @philnik777 Do you have any suggestions for this?
https://github.com/llvm/llvm-project/pull/84840
More information about the libcxx-commits
mailing list