[clang] [clang] Improve diagnostic on [[nodiscard]] attribute (PR #112521)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 22 11:21:36 PDT 2024
================
@@ -416,6 +416,9 @@ Improvements to Clang's diagnostics
name was a reserved name, which we improperly allowed to suppress the
diagnostic.
+- Clang now includes the return type of the function or constructor in the warning generated
+ when `[[nodiscard]]` is triggered by its placement on return types instead of function itself.
----------------
Sirraide wrote:
```suggestion
- When diagnosing an unused return value of a type declared ``[[nodiscard]]``, the type
itself is now included in the diagnostic.
```
I think this way it’s a bit easier to understand what’s happening here. This is the best I could do while trying to avoid the mouthful that is ‘ignoring a value returned from a call to a function returning a type marked nodiscard’.
https://github.com/llvm/llvm-project/pull/112521
More information about the cfe-commits
mailing list