[libcxx-commits] [libcxx] [libc++] Revert undesired `[[nodiscard]]` added to conversion functions (PR #173658)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jan 8 04:19:10 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.
----------------
philnik777 wrote:
Yeah, seems fine. We have bigger QoI problems with GCC than diagnostic behaviour, so I don't think we should look to closely there. We're primarily targeting Clang after all.
https://github.com/llvm/llvm-project/pull/173658
More information about the libcxx-commits
mailing list