[clang] [clang] Add the candiscard attribute to suppress nodiscard (PR #154943)

via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 24 18:09:36 PDT 2025


halbi2 wrote:

> Thank you working on this! Can you explain why we introduce this new attribute in summary?

@yronglin Compiler support for this new attribute is required by @philnik777 before libc++ can mark its `std::expected` with the `[[nodiscard]]` attribute, as requested in #130656 and already done by Microsoft C++, LLVM itself (`llvm::Expected`) and Rust. This will bring libc++ up to snuff with other C++ implementations.

Personally I do not think this attribute will be used by programmers, it is just purely a requirement for fixing #130656.

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


More information about the cfe-commits mailing list