[clang-tools-extra] [clang-tidy] fix false positive in cppcoreguidelines-missing-std-forward (PR #77056)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 5 04:59:57 PST 2024
================
@@ -147,4 +147,24 @@ class AClass {
T data;
};
+template <class T>
+void lambda_value_reference(T&& t) {
+ [&]() { T other = std::forward<T>(t); };
+}
+
+template<typename T>
+void lambda_value_reference_capture_list_ref_1(T&& t) {
+ [=, &t] { T other = std::forward<T>(t); };
+}
+
+template<typename T>
+void lambda_value_reference_capture_list_ref_2(T&& t) {
+ [&t] { T other = std::forward<T>(t); };
+}
+
+template<typename T>
+void lambda_value_reference_capture_list(T&& t) {
+ [t = std::forward<T>(t)] { t(); };
+}
+
----------------
PiotrZSL wrote:
missing:
```
template <class T>
void lambda_value_reference(T&& t) {
[&x = t]() { T other = std::forward<T>(x); };
}
```
and same with std::forward.
https://github.com/llvm/llvm-project/pull/77056
More information about the cfe-commits
mailing list