[PATCH] D119670: [clang] Warn on unqualified calls to std::move and std::forward

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 14 06:49:39 PST 2022


erichkeane added a comment.

I'm not sure this is a 'good' enough warning (by design?) to allow in -Wall either, Wall seems to be only "this is definitely a mistake" type issues, and I don't think this issue rises to that requirement (though others are likely more qualified <get it!> than I to judge).

Implementation generally looks right to me otherwise, with 1 question/comment.



================
Comment at: clang/lib/Sema/SemaExpr.cpp:6437
+  NamedDecl *D = dyn_cast_or_null<NamedDecl>(Call->getCalleeDecl());
+  if (!D || !D->isInStdNamespace())
+    return;
----------------
Do we really want this?  I guess I would think doing:


```
void MyFunc(auto whatever) {
  auto X = move(whatever);
```

when I MEAN std::move, just for it to pick up a non-std::move the 1st time is likely the same problem?  Or should it get a separate warning?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119670/new/

https://reviews.llvm.org/D119670



More information about the cfe-commits mailing list