[libcxx-commits] [libcxx] [libc++][optional] Applied `[[nodiscard]]` (PR #170045)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 1 00:06:04 PST 2025


================
@@ -275,7 +275,7 @@ public:
   _LIBCPP_HIDE_FROM_ABI bad_optional_access& operator=(const bad_optional_access&) _NOEXCEPT = default;
   // Get the key function ~bad_optional_access() into the dylib
   ~bad_optional_access() _NOEXCEPT override;
-  const char* what() const _NOEXCEPT override;
+  [[__nodiscard__]] const char* what() const _NOEXCEPT override;
----------------
frederick-vs-ja wrote:

No change requested. I very wonder whether we decided to expose `bad_optional_access` to old modes. @EricWF 

https://github.com/llvm/llvm-project/pull/170045


More information about the libcxx-commits mailing list