opencv / ade

Apache License 2.0
59 stars 49 forks source link

Fixed warning which happens with old compilers (which are still supported in OpenCV) #17

Closed AsyaPronina closed 4 years ago

AsyaPronina commented 4 years ago

@Hardcode84 @andrey-golubev Guys could you please take a look

Hardcode84 commented 4 years ago

Can you please add compiler version and warning text to PR description

andrey-golubev commented 4 years ago

@Hardcode84 @AsyaPronina current warning with GCC-4.8 in my setup

ade/sources/ade/source/execution_engine.cpp: In member function ‘std::unique_ptr<ade::Executable> ade::ExecutionEngine::createExecutable(const ade::Graph&)’:
ade/sources/ade/source/execution_engine.cpp:144:12: error: cannot bind ‘std::unique_ptr<ade::ExecutableImpl>’ lvalue to ‘std::unique_ptr<ade::ExecutableImpl>&&’
     return ret;
            ^
In file included from /usr/include/c++/4.8/memory:81:0,
                 from ade/sources/ade/include/ade/execution_engine/execution_engine.hpp:12,
                 from ade/sources/ade/source/execution_engine.cpp:7:
/usr/include/c++/4.8/bits/unique_ptr.h:169:2: error:   initializing argument 1 of ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(std::unique_ptr<_Up, _Ep>&&) [with _Up = ade::ExecutableImpl; _Ep = std::default_delete<ade::ExecutableImpl>; <template-parameter-2-3> = void; _Tp = ade::Executable; _Dp = std::default_delete<ade::Executable>]’
  unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
  ^
ade/sources/ade/source/execution_engine.cpp:145:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1plus: all warnings being treated as errors
andrey-golubev commented 4 years ago

@AsyaPronina feel free to add it "as is" to the description

andrey-golubev commented 4 years ago

@Hardcode84 yet again if we add a simple std::move(ret) the fix like https://github.com/opencv/ade/pull/15 will arise. Current version works both on GCC 4.8 && GCC 9

Hardcode84 commented 4 years ago

LGTM