[libcxx-commits] [libcxx] [libc++] mark `std::expected` as `nodiscard` (PR #130820)
Mohamed Emad via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 11 12:32:05 PDT 2025
https://github.com/hulxv created https://github.com/llvm/llvm-project/pull/130820
Fix #130656
>From 5ef0eb9e5159c6d04eefb24a1afe69a9a3c83e50 Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Tue, 11 Mar 2025 21:30:25 +0200
Subject: [PATCH] [libc++] mark `std::expected` as `nodiscard` (fix #130656)
---
libcxx/include/__cxx03/__expected/expected.h | 2 +-
libcxx/include/__expected/expected.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
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 {};
More information about the libcxx-commits
mailing list