From b2842b20cf0952821fc6e0be463571b87b03d1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Thu, 13 Jun 2019 12:13:01 +0200 Subject: [PATCH] Avoid pessimizing moves in threaded_queue.hh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clang produces warnings during compilation: ccls/src/threaded_queue.hh:150:27: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move] ccls/src/threaded_queue.hh:150:27: note: remove ‘std::move’ call This patch fixes the issue. --- src/threaded_queue.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/threaded_queue.hh b/src/threaded_queue.hh index 103027aa..a7ffe9df 100644 --- a/src/threaded_queue.hh +++ b/src/threaded_queue.hh @@ -147,7 +147,7 @@ public: auto val = std::move(q->front()); q->pop_front(); --total_count_; - return std::move(val); + return val; }; if (!priority_.empty()) return execute(&priority_); @@ -162,7 +162,7 @@ public: auto val = std::move(q->front()); q->pop_front(); --total_count_; - return std::move(val); + return val; }; if (priority_.size()) return execute(&priority_);