Author: alexfh Date: Mon May 22 09:30:14 2017 New Revision: 303554 URL: http://llvm.org/viewvc/llvm-project?rev=303554&view=rev Log: [clang-tidy] misc-move-const-arg shouldn't complain on std::move(lambda)
Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp clang-tools-extra/trunk/test/clang-tidy/misc-move-const-arg.cpp Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp?rev=303554&r1=303553&r2=303554&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp Mon May 22 09:30:14 2017 @@ -74,6 +74,12 @@ void MoveConstantArgumentCheck::check(co if (IsConstArg || IsTriviallyCopyable) { if (const CXXRecordDecl *R = Arg->getType()->getAsCXXRecordDecl()) { + // According to [expr.prim.lambda]p3, "whether the closure type is + // trivially copyable" property can be changed by the implementation of + // the language, so we shouldn't rely on it when issuing diagnostics. + if (R->isLambda()) + return; + // Don't warn when the type is not copyable. for (const auto *Ctor : R->ctors()) { if (Ctor->isCopyConstructor() && Ctor->isDeleted()) return; Modified: clang-tools-extra/trunk/test/clang-tidy/misc-move-const-arg.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-move-const-arg.cpp?rev=303554&r1=303553&r2=303554&view=diff ============================================================================== --- clang-tools-extra/trunk/test/clang-tidy/misc-move-const-arg.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/misc-move-const-arg.cpp Mon May 22 09:30:14 2017 @@ -157,6 +157,9 @@ void moveToConstReferenceNegatives() { // No warning inside of macro expansion, even if the macro expansion is inside // a lambda that is, in turn, an argument to a macro. CALL([no_move_semantics] { M3(NoMoveSemantics, no_move_semantics); }); + + auto lambda = [] {}; + auto lambda2 = std::move(lambda); } class MoveOnly { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits