From: Richard Trieu Date: Mon, 16 Dec 2013 21:41:30 +0000 (+0000) Subject: Fix PR18260 - Make std::move handling in -Wconsumed only trigger on std::move X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae7040c1654585c70be040e201caca7f8ce6135c;p=clang Fix PR18260 - Make std::move handling in -Wconsumed only trigger on std::move git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197428 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/Consumed.cpp b/lib/Analysis/Consumed.cpp index b33c8d8930..5e1448d0bf 100644 --- a/lib/Analysis/Consumed.cpp +++ b/lib/Analysis/Consumed.cpp @@ -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; } diff --git a/test/SemaCXX/warn-consumed-analysis.cpp b/test/SemaCXX/warn-consumed-analysis.cpp index 64fdc00dc5..5297981ade 100644 --- a/test/SemaCXX/warn-consumed-analysis.cpp +++ b/test/SemaCXX/warn-consumed-analysis.cpp @@ -793,3 +793,22 @@ void testTemporariesAndOperators2() { } // end namespace InitializerAssertionFailTest + +namespace std { + void move(); + template + void move(T&&); +} + +namespace PR18260 { + class X { + public: + void move(); + } x; + + void test() { + x.move(); + std::move(); + std::move(x); + } +} // end namespace PR18260