summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-04-03 16:59:53 +0200
committerMax Kellermann <max@musicpd.org>2019-04-03 16:59:53 +0200
commit37b54179d882fef38ca6735b53e322027414b62e (patch)
treea658fa87a87f6ea4f5413d19b533cd836fb36824
parent511826763a77f21669405fe2d48c88f0e4ba5a9f (diff)
net/IPv[46]Address: add cast to void* to fix GCC9 build failure
Fixes: src/net/IPv4Address.hxx: In member function 'constexpr IPv4Address::operator SocketAddress() const': src/net/IPv4Address.hxx:171:24: error: a reinterpret_cast is not a constant expression 171 | return SocketAddress((const struct sockaddr *)&address, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/net/IPv6Address.hxx: In member function 'constexpr IPv6Address::operator SocketAddress() const': src/net/IPv6Address.hxx:138:24: error: a reinterpret_cast is not a constant expression 138 | return SocketAddress((const struct sockaddr *)&address, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Closes https://github.com/MusicPlayerDaemon/MPD/issues/522
-rw-r--r--NEWS1
-rw-r--r--src/net/IPv4Address.hxx2
-rw-r--r--src/net/IPv6Address.hxx2
3 files changed, 3 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 90eb2286e..388f8dd7b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
ver 0.21.8 (not yet released)
+* fix build failure with GCC 9
ver 0.21.7 (2019/04/03)
* input
diff --git a/src/net/IPv4Address.hxx b/src/net/IPv4Address.hxx
index 7a39ed016..3af0210c3 100644
--- a/src/net/IPv4Address.hxx
+++ b/src/net/IPv4Address.hxx
@@ -168,7 +168,7 @@ public:
}
constexpr operator SocketAddress() const noexcept {
- return SocketAddress((const struct sockaddr *)&address,
+ return SocketAddress((const struct sockaddr *)(const void *)&address,
sizeof(address));
}
diff --git a/src/net/IPv6Address.hxx b/src/net/IPv6Address.hxx
index e9531b3f7..eae9b60c1 100644
--- a/src/net/IPv6Address.hxx
+++ b/src/net/IPv6Address.hxx
@@ -135,7 +135,7 @@ public:
}
constexpr operator SocketAddress() const noexcept {
- return SocketAddress((const struct sockaddr *)&address,
+ return SocketAddress((const struct sockaddr *)(const void *)&address,
sizeof(address));
}