diff --git a/src/net/StaticSocketAddress.hxx b/src/net/StaticSocketAddress.hxx index 7a5d0a218..e6f7572dd 100644 --- a/src/net/StaticSocketAddress.hxx +++ b/src/net/StaticSocketAddress.hxx @@ -54,17 +54,16 @@ public: StaticSocketAddress &operator=(SocketAddress other) noexcept; - operator SocketAddress() const noexcept { - return SocketAddress(reinterpret_cast(&address), - size); + constexpr operator SocketAddress() const noexcept { + return SocketAddress(*this, size); } - operator struct sockaddr *() noexcept { - return reinterpret_cast(&address); + constexpr operator struct sockaddr *() noexcept { + return (struct sockaddr *)(void *)&address; } - operator const struct sockaddr *() const noexcept { - return reinterpret_cast(&address); + constexpr operator const struct sockaddr *() const noexcept { + return (const struct sockaddr *)(const void *)&address; } constexpr size_type GetCapacity() const noexcept {