continuable icon indicating copy to clipboard operation
continuable copied to clipboard

redundant move in return statement

Open Spongman opened this issue 2 years ago • 0 comments

@Naios

I get the following when building the current master branch (using cmake). I get the same thing when building my own code using the library, with optimizations enabled:

[0/2] Re-checking globbed directories...
[11/158] Building CXX object test/unit-test/CMakeFiles/test-continuable-single.dir/single/test-continuable-result.cpp.o
In file included from /home/user/continuable/include/continuable/continuable-result.hpp:37,
                 from /home/user/continuable/test/unit-test/single/test-continuable-result.cpp:27:
/home/user/continuable/include/continuable/../continuable/detail/utility/result-trait.hpp: In instantiation of ‘static cti::detail::result_trait<T>::surrogate_t cti::detail::result_trait<T>::wrap(T) [with T = std::shared_ptr<int>; cti::detail::result_trait<T>::surrogate_t = std::shared_ptr<int>]’:
/home/user/continuable/include/continuable/continuable-result.hpp:159:29:   required from ‘cti::result<T>::result(FirstArg&&, Args&& ...) [with FirstArg = std::shared_ptr<int>; Args = {}; T = {std::shared_ptr<int>}]’
/home/user/continuable/test/unit-test/single/test-continuable-result.cpp:256:55:   required from here
/home/user/continuable/include/continuable/../continuable/detail/utility/result-trait.hpp:65:25: warning: redundant move in return statement [-Wredundant-move]
   65 |     return std::move(arg);
      |                         ^
/home/user/continuable/include/continuable/../continuable/detail/utility/result-trait.hpp:65:25: note: remove ‘std::move’ call

Commit Hash 63e3ed4edccfc3bcc3c8ceb12b857432eb4ee9a3

Steps to Reproduce

mkdir build
cd build
cmake -G Ninja ..
ninja-build

Your Environment

  • OS: centos7
  • Compiler and version: gcc 10.2

Spongman avatar Nov 07 '22 20:11 Spongman