[libcxx-commits] [libcxx] [libc++][expected] Applied `[[nodiscard]]` (PR #170245)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 11 19:18:01 PST 2025


================
@@ -43,9 +43,11 @@ class _LIBCPP_EXPORTED_FROM_ABI bad_expected_access<void> : public exception {
 
 public:
 #  if _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION
-  const char* what() const noexcept override;
+  [[nodiscard]] const char* what() const noexcept override;
----------------
frederick-vs-ja wrote:

No change requested for this. We can write `[[nodiscard]]` only once out of the `#if`, should we do so?

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


More information about the libcxx-commits mailing list