Skip to content

Commit 7f60f27

Browse files
committed
Work around warning that occurs when building with _FORTIFY_SOURCE.
1 parent 62e5597 commit 7f60f27

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

include/boost/asio/ip/detail/endpoint.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ class endpoint
6060
// Get the underlying endpoint in the native type.
6161
boost::asio::detail::socket_addr_type* data() noexcept
6262
{
63-
return &data_.base;
63+
return &data_.base[0];
6464
}
6565

6666
// Get the underlying endpoint in the native type.
6767
const boost::asio::detail::socket_addr_type* data() const noexcept
6868
{
69-
return &data_.base;
69+
return &data_.base[0];
7070
}
7171

7272
// Get the underlying size of the endpoint in the native type.
@@ -111,7 +111,7 @@ class endpoint
111111
// Determine whether the endpoint is IPv4.
112112
bool is_v4() const noexcept
113113
{
114-
return data_.base.sa_family == BOOST_ASIO_OS_DEF(AF_INET);
114+
return data_.base[0].sa_family == BOOST_ASIO_OS_DEF(AF_INET);
115115
}
116116

117117
#if !defined(BOOST_ASIO_NO_IOSTREAM)
@@ -123,7 +123,11 @@ class endpoint
123123
// The underlying IP socket address.
124124
union data_union
125125
{
126-
boost::asio::detail::socket_addr_type base;
126+
#if defined(_FORTIFY_SOURCE)
127+
boost::asio::detail::socket_addr_type base[8];
128+
#else // defined(_FORTIFY_SOURCE)
129+
boost::asio::detail::socket_addr_type base[1];
130+
#endif // defined(_FORTIFY_SOURCE)
127131
boost::asio::detail::sockaddr_in4_type v4;
128132
boost::asio::detail::sockaddr_in6_type v6;
129133
} data_;

0 commit comments

Comments
 (0)