[libcxx-commits] [libcxx] [libc++] Revert undesired `[[nodiscard]]` added to conversion functions (PR #173658)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jan 3 18:00:02 PST 2026


================
@@ -165,6 +165,8 @@ have a recommended practice where to put them, so libc++ applies it whenever it
   This protects programmers from assuming too much about how the internals of a function work, making code more robust
   in the presence of future optimizations.
 
+``[[nodiscard]]`` should not be applied to conversion functions because Clang already diagnoses unused cast results.
----------------
frederick-vs-ja wrote:

@philnik777 Would this be fine enough? Also, I noticed that this is true for Clang but not GCC.

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


More information about the libcxx-commits mailing list