[LLVMbugs] [Bug 23819] New: -Wpessimizing-move sometimes issued where -Wredundant-move would be appropriate

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 11 13:41:26 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23819

            Bug ID: 23819
           Summary: -Wpessimizing-move sometimes issued where
                    -Wredundant-move would be appropriate
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Case 1: "moving a temporary object prevents copy elision" diagnosed even though
no copy would be made anyway:

  struct X {};
  X g();
  void h(X&&);
  void f() { h(std::move(g())); }

Case 2: "moving a local object in a return statement prevents copy elision"
issued even though copy elision is not possible, because we're returning a
function parameter:

  X f(X x) { return std::move(x); }

In both of these cases we should issue a -Wredundant-move warning instead.

-- 
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/20150611/6bededde/attachment.html>


More information about the llvm-bugs mailing list