-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix build warnings: local variable 's' will be copied despite being returned by name #2148
Conversation
Fix warning at build like: ``` [ 85%] Building CXX object CMakeFiles/kvrocks_objs.dir/src/cluster/slot_import.cc.o /Users/runner/work/kvrocks/kvrocks/src/cluster/replication.cc:78:10: warning: local variable 's' will be copied despite being returned by name [-Wreturn-std-move] return s; ^ /Users/runner/work/kvrocks/kvrocks/src/cluster/replication.cc:78:10: note: call 'std::move' explicitly to avoid copying return s; ^ std::move(s) [ 85%] Building CXX object CMakeFiles/kvrocks_objs.dir/src/cluster/slot_migrate.cc.o [ 85%] Building CXX object CMakeFiles/kvrocks_objs.dir/src/cluster/sync_migrate_context.cc.o ```
…apache/kvrocks into aleksraiden-fix-warning-build-1
@@ -75,7 +75,7 @@ Status FeedSlaveThread::Start() { | |||
conn_ = nullptr; // prevent connection was freed when failed to start the thread | |||
} | |||
|
|||
return s; | |||
return std::move(s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm C++17 would applying nrvo for this ? @PragmaTwice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type of returned value is not the same as the return type. So no.
Quality Gate passedIssues Measures |
Fix warning at build like: