https://llvm.org/bugs/show_bug.cgi?id=25911
Bug ID: 25911 Summary: -Wpessimizing-move doesn't trigger inside template instantiations Product: clang Version: unspecified Hardware: PC OS: Windows NT Status: NEW Severity: normal Priority: P Component: C++11 Assignee: unassignedclangb...@nondot.org Reporter: dch...@google.com CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified https://llvm.org/bugs/show_bug.cgi?id=9679 is a bug that indicates that it's generally unsafe to emit fix-its inside template instantiations. However, this leads to omission of a pessimizing-move warning in some circumstances where it could apply. One example: dcheng@nausicaa:~/src/chrome/src$ cat test.cc #include <utility> template<typename T> class my_scoped_ptr { public: explicit my_scoped_ptr(T* ptr) : ptr_(ptr) {} ~my_scoped_ptr() { delete ptr_; } my_scoped_ptr(my_scoped_ptr&& other) : ptr_(nullptr) { using std::swap; swap(ptr_, other.ptr_); } static my_scoped_ptr New() { return std::move(my_scoped_ptr(nullptr)); } private: T* ptr_; }; int main() { my_scoped_ptr<int> scoper = my_scoped_ptr<int>::New(); } dcheng@nausicaa:~/src/chrome/src$ third_party/llvm-build/Release+Asserts/bin/clang++ -std=c++11 -W all test.cc dcheng@nausicaa:~/src/chrome/src$ -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs