[llvm-bugs] [Bug 42832] New: -Wpessimizing-move and -Wredundant-move are applicable only when returned expression is id-expression

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 30 12:19:41 PDT 2019


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

            Bug ID: 42832
           Summary: -Wpessimizing-move and -Wredundant-move are applicable
                    only when returned expression is id-expression
           Product: clang
           Version: 8.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.a.davydov at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

-Wredundant-move: (https://gcc.godbolt.org/z/j2CTqF)

std::unique_ptr<int> f(std::unique_ptr<int> param)
{
    // clang shows "redundant move", but without it code doesn't compile
    return { std::move(param) };
}

-Wpessimizing-move: (https://gcc.godbolt.org/z/2DIBcC)

std::unique_ptr<int> f()
{
    std::unique_ptr<int> result;
    // clang shows "pessimizing move", but without it code doesn't compile
    return { std::move(result) };
}

-- 
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/20190730/bea8af87/attachment.html>


More information about the llvm-bugs mailing list