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

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 11 22:13:03 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;
----------------
H-G-Hristov wrote:

I think that splitting the delclarations harms the readability.

If our formatting style was like shown bellow it would be less confusing but it isn't:

```c++
[[attributes]]
auto func() {
    ...
}
```

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


More information about the libcxx-commits mailing list