[libcxx-commits] [libcxx] [libc++] mark `std::expected` as `nodiscard` (PR #130820)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 13 00:41:25 PDT 2025


https://github.com/frederick-vs-ja requested changes to this pull request.

We should also add `[[nodiscard]]` to these partial specialization:
https://github.com/llvm/llvm-project/blob/bd748b33958f8889d280afd4396b189edd0745bf/libcxx/include/__expected/expected.h#L1355-L1358

Per CI failures, we should add `void` cast to function calls in these files to suppress warnings:
- `libcxx/utilities/expected/expected.expected/and_then.mandates.verify.cpp`
- `libcxx/utilities/expected/expected.expected/or_else.mandates.verify.cpp`
- `libcxx/utilities/expected/expected.void/and_then.mandates.verify.cpp`
- `libcxx/utilities/expected/expected.void/or_else.mandates.verify.cpp`

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


More information about the libcxx-commits mailing list