[libcxx-commits] [libcxx] [libc++] mark `std::expected` as `nodiscard` (PR #130820)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 11 12:32:56 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Mohamed Emad (hulxv)
<details>
<summary>Changes</summary>
Fix #<!-- -->130656
---
Full diff: https://github.com/llvm/llvm-project/pull/130820.diff
2 Files Affected:
- (modified) libcxx/include/__cxx03/__expected/expected.h (+1-1)
- (modified) libcxx/include/__expected/expected.h (+1-1)
``````````diff
diff --git a/libcxx/include/__cxx03/__expected/expected.h b/libcxx/include/__cxx03/__expected/expected.h
index 1d54bb9f6edeb..ce9676c68c2dc 100644
--- a/libcxx/include/__cxx03/__expected/expected.h
+++ b/libcxx/include/__cxx03/__expected/expected.h
@@ -58,7 +58,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Err>
-class expected;
+class [[nodiscrad]] expected;
template <class _Tp>
struct __is_std_expected : false_type {};
diff --git a/libcxx/include/__expected/expected.h b/libcxx/include/__expected/expected.h
index 03bbd1623ed5c..8dd32668bcb33 100644
--- a/libcxx/include/__expected/expected.h
+++ b/libcxx/include/__expected/expected.h
@@ -60,7 +60,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Err>
-class expected;
+class [[nodiscard]] expected;
template <class _Tp>
struct __is_std_expected : false_type {};
``````````
</details>
https://github.com/llvm/llvm-project/pull/130820
More information about the libcxx-commits
mailing list