Discussion:
[mpd-devel] [PATCH] ReusableArray: fix build error on GCC7
Ben Boeckel
2017-02-27 02:34:11 UTC
Permalink
GCC7 outputs the following error without this change:

src/util/ReusableArray.hxx:61:35: error: no matching function for call to ‘swap(size_t&, const size_t&)’
std::swap(capacity, src.capacity);

which can be resolved by just using an rvalue-reference rather than a
const rvalue-reference.

Signed-off-by: Ben Boeckel <***@gmail.com>
---
src/util/ReusableArray.hxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/ReusableArray.hxx b/src/util/ReusableArray.hxx
index f309e8322..cb40e610a 100644
--- a/src/util/ReusableArray.hxx
+++ b/src/util/ReusableArray.hxx
@@ -56,7 +56,7 @@ public:
:buffer(std::exchange(src.buffer, nullptr)),
capacity(std::exchange(src.capacity, 0)) {}

- ReusableArray &operator=(const ReusableArray &&src) {
+ ReusableArray &operator=(ReusableArray &&src) {
std::swap(buffer, src.buffer);
std::swap(capacity, src.capacity);
return *this;
--
2.11.1
Max Kellermann
2017-03-01 18:39:17 UTC
Permalink
src/util/ReusableArray.hxx:61:35: error: no matching function for call to ???swap(size_t&, const size_t&)???
std::swap(capacity, src.capacity);
which can be resolved by just using an rvalue-reference rather than a
const rvalue-reference.
Merged into v0.20.x

Loading...