]> granicus.if.org Git - clang/commitdiff
Fix PR18260 - Make std::move handling in -Wconsumed only trigger on std::move
authorRichard Trieu <rtrieu@google.com>
Mon, 16 Dec 2013 21:41:30 +0000 (21:41 +0000)
committerRichard Trieu <rtrieu@google.com>
Mon, 16 Dec 2013 21:41:30 +0000 (21:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197428 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/Consumed.cpp
test/SemaCXX/warn-consumed-analysis.cpp

index b33c8d8930f841b09e55c1675b23354ef75aaf85..5e1448d0bf3c6baa3b3e5b94405ea35e59b412b6 100644 (file)
@@ -611,7 +611,8 @@ void ConsumedStmtVisitor::VisitCallExpr(const CallExpr *Call) {
     
     // Special case for the std::move function.
     // TODO: Make this more specific. (Deferred)
-    if (FunDecl->getNameAsString() == "move") {
+    if (FunDecl->getQualifiedNameAsString() == "std::move" &&
+        Call->getNumArgs() == 1) {
       forwardInfo(Call->getArg(0), Call);
       return;
     }
index 64fdc00dc516a2667c5b8015975bd54f91afd93b..5297981ade1f3a669390dbda6985ba183e75b9bd 100644 (file)
@@ -793,3 +793,22 @@ void testTemporariesAndOperators2() {
 
 } // end namespace InitializerAssertionFailTest
 
+
+namespace std {
+  void move();
+  template<class T>
+  void move(T&&);
+}
+
+namespace PR18260 {
+  class X {
+    public:
+      void move();
+  } x;
+
+  void test() {
+    x.move();
+    std::move();
+    std::move(x);
+  }
+} // end namespace PR18260