_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Note that the move (into the implicit JITSymbol(Error) ctor) is only
redundant if the compiler implements a fix for
<http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579>
"Return by converting move constructor". (But not sure whether the LLVM
compiler baselines imply that, anyway. In LibreOffice it forced me to
introduce ugly #ifs, to not have to disable that warning outright,
<https://cgit.freedesktop.org/libreoffice/core/commit/?id=dc06c8f4989fc28d0c31ebd333e53dfe0e0f5f66>
"-Werror=redundant-move (GCC 9), take two".)
On 13/09/2018 18:22, David Blaikie via llvm-dev wrote:
> On Thu, Sep 13, 2018 at 12:13 AM Dávid Bolvanský via llvm-dev
> <llvm...@lists.llvm.org <mailto:llvm...@lists.llvm.org>> wrote:
> /home/davidbolvansky/trunk/llvm/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp:79:40:
> required from here
> /home/davidbolvansky/trunk/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h:314:29:
> warning: redundant move in return statement [-Wredundant-move]
> 314 | return std::move(Err);
Note that the move (into the implicit JITSymbol(Error) ctor) is only
redundant if the compiler implements a fix for
<http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579>
"Return by converting move constructor". (But not sure whether the LLVM
compiler baselines imply that, anyway.
_______________________________________________
cfe-dev mailing list
cfe...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
+ Erik, who implemented DR1579Originally, I had the warning similar to GCC's warning, but took it out due to not having DR1579 implemented in clang (warning changed in r243594)Erik in r274291 implemented DR1579, although PR27785 didn't mention anything about std::moveIt looks like what's happening is that Clang and GCC handles the return differently. Clang needs the std::move call to use the move constructor while GCC will use the move constructor with or without the std::move call. This means that the warning is currently correct when running on either compiler.This is a reduced example. Compiled with Clang, it will print "move constructor" then "copy constructor". GCC will print "move constructor" twice.
For the erroneous GCC behavior, see
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87150> "move ctor wrongly
chosen in return stmt (derived vs. base)".
On Mon, 24 Sep 2018, 20:40 Richard Trieu via cfe-dev, <cfe...@lists.llvm.org> wrote:+ Erik, who implemented DR1579Originally, I had the warning similar to GCC's warning, but took it out due to not having DR1579 implemented in clang (warning changed in r243594)Erik in r274291 implemented DR1579, although PR27785 didn't mention anything about std::moveIt looks like what's happening is that Clang and GCC handles the return differently. Clang needs the std::move call to use the move constructor while GCC will use the move constructor with or without the std::move call. This means that the warning is currently correct when running on either compiler.This is a reduced example. Compiled with Clang, it will print "move constructor" then "copy constructor". GCC will print "move constructor" twice.GCC gets the rule "wrong". The rule in question (http://eel.is/c++draft/class.copy.elision#3.sentence-2) only applies when the selected B constructor takes A&& as its parameter type.