[clang-tools-extra] [clang-tidy] fix false positive in bugprone-return-const-ref-from-parameter (PR #117734)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 09:14:12 PST 2024
================
@@ -151,6 +151,12 @@ void instantiate(const int ¶m, const float ¶mf, int &mut_param, float &m
itf6(mut_paramf);
}
+template<class T>
+void f(const T& t) {
+ const auto get = [&t] -> const T& { return t; };
+ return T{};
+}
----------------
PiotrZSL wrote:
Please add test:
```
const auto get = [](const T& t2) -> const T& { return t2; };
```
and verify that it's being still detected.
https://github.com/llvm/llvm-project/pull/117734
More information about the cfe-commits
mailing list