================
@@ -80,13 +88,16 @@ void 
MoveForwardingReferenceCheck::registerMatchers(MatchFinder *Finder) {
           .bind("parm-var");
 
   Finder->addMatcher(
-      callExpr(callee(unresolvedLookupExpr(
-                          hasAnyDeclaration(namedDecl(
-                              hasUnderlyingDecl(hasName("::std::move")))))
-                          .bind("lookup")),
-               argumentCountIs(1),
-               hasArgument(0, ignoringParenImpCasts(declRefExpr(
-                                  to(ForwardingReferenceParmMatcher)))))
+      callExpr(
+          callee(unresolvedLookupExpr(
+                     hasAnyDeclaration(
+                         namedDecl(hasUnderlyingDecl(hasName("::std::move")))))
+                     .bind("lookup")),
+          argumentCountIs(1),
+          hasArgument(0, ignoringParenImpCasts(declRefExpr(
+                             to(ForwardingReferenceParmMatcher),
+                             // FIXME: allow capture by reference
----------------
serge-sans-paille wrote:

Consider this:
```
template<class T> void foo(T&& t) {
   [&t]() {
         bar(std::move(t));
  }();
}
```
if `foo` is called with an l-value, this example moves the reference content, 
the intent was probably

```
template<class T> void foo(T&& t) {
   [&t]() {
         bar(std::forward<T>(t));
  }();
}
```


https://github.com/llvm/llvm-project/pull/191435
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to