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
This commit is contained in:
Max Kellermann 2019-04-03 16:59:53 +02:00
parent 511826763a
commit 37b54179d8
3 changed files with 3 additions and 2 deletions

1
NEWS
View File

@ -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

View File

@ -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));
}

View File

@ -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));
}