Naios / continuable

C++14 asynchronous allocation aware futures (supporting then, exception handling, coroutines and connections)
https://naios.github.io/continuable/
MIT License
815 stars 44 forks source link

redundant move in return statement #57

Open Spongman opened 1 year ago

Spongman commented 1 year ago

@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