llvm-project
d3a4bb08 - [clang-tidy] Avoid `use-nodiscard` false positives for class templates (#196661)

Commit
3 days ago
[clang-tidy] Avoid `use-nodiscard` false positives for class templates (#196661) Do not suggest adding `[[nodiscard]]` to functions returning a class template specialization whose primary template is already marked `[[nodiscard]]`. Class template specializations do not carry the `[[nodiscard]]` attribute on their own declarations, so `modernize-use-nodiscard` previously missed this case and emitted redundant diagnostics for return types such as: ```cpp template <class T> struct [[nodiscard]] Result; Result<int> f() const; ``` Fixes #163425.
Author
Parents
Loading