[LLVMbugs] [Bug 19591] New: suggest std::move

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 28 15:35:14 PDT 2014


            Bug ID: 19591
           Summary: suggest std::move
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat a.cc
#include <memory>

void f(std::unique_ptr<int> i) {
  std::unique_ptr<int> j = i;

$ clang a.cc -std=c++11
a.cc:4:24: error: call to deleted constructor of 'std::unique_ptr<int>'
  std::unique_ptr<int> j = i;
                       ^   ~
      'unique_ptr' has been explicitly marked deleted here
      unique_ptr(const unique_ptr&) = delete;
1 error generated.

Could we detect that there is a rvalue-reference constructor and suggest that
the user may have wanted to use it (or std::move)?

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140428/ddb37f96/attachment.html>

More information about the llvm-bugs mailing list