[libcxx-commits] [libcxx] [libc++] Mark std::expected as nodiscard (PR #139651)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 18 05:20:15 PDT 2026
H-G-Hristov wrote:
@philnik777 @ldionne
As previously discussed in: github.com/llvm/llvm-project/pull/130820 MSVC STL has annotated `expected` and more related classes with `[[nodiscard]]`:
- https://github.com/microsoft/STL/blob/2626cf1ee9d26be701b9bdbd2fb30db240456456/stl/inc/expected#L208
Recently stdlibc++ also annotated `expected` with `[[nodiscard]]`:
- https://github.com/gcc-mirror/gcc/commit/300f170835d3d34c22c1c15dfb8df42aa5ebebff
- https://github.com/gcc-mirror/gcc/blob/17880c0f3981d9f8ab89959064dd52086215e5db/libstdc%2B%2B-v3/include/std/expected#L370
In that context: Do we want to follow the crowd and proceed with annotating `expected` to be consistent with the other implementations or do we still don't want to do it yet?
https://github.com/llvm/llvm-project/pull/139651
More information about the libcxx-commits
mailing list