diff options
author | Max Kellermann <max@musicpd.org> | 2019-04-03 16:59:53 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-04-03 16:59:53 +0200 |
commit | 37b54179d882fef38ca6735b53e322027414b62e (patch) | |
tree | a658fa87a87f6ea4f5413d19b533cd836fb36824 | |
parent | 511826763a77f21669405fe2d48c88f0e4ba5a9f (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-- | NEWS | 1 | ||||
-rw-r--r-- | src/net/IPv4Address.hxx | 2 | ||||
-rw-r--r-- | src/net/IPv6Address.hxx | 2 |
3 files changed, 3 insertions, 2 deletions
@@ -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)); } |