]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix internet socket option classes
authorJonathan Wakely <jwakely@redhat.com>
Mon, 26 Apr 2021 20:16:21 +0000 (21:16 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 26 Apr 2021 20:16:21 +0000 (21:16 +0100)
commit2e0b1c6ce3afe0670b96444c6b955ce184ed0046
tree491b77ba5e207d3b291eeba854415aec3ca07016
parent06c86a4f210c76a157512a2963e6c31302d161cb
libstdc++: Fix internet socket option classes

Similar to the previous commit, this fixes various problems with the
socket options classes in the <internet> header:

- The constructors were not noexcept.
- The __sockopt_base<T>::value() member function was present
  unconditionally (so was defined for socket_base::linger which is
  incorrect).
- The __socket_crtp<C, T>::operator=(T) assignment operator was not
  noexcept, and was hidden in the derived classes.
- The MulticastSocketOptions incorrectly used a union, incorrectly
  defined resize and const data() member functions, and their
  constructors were unimplemented.

Also, where appropriate:

- Use class instead of struct for the socket option types.
- Define the _S_level and _S_name constants as private.
- Declare the __socket_crtp base as a friend.

libstdc++-v3/ChangeLog:

* include/experimental/internet (tcp::no_delay, v6_only)
(unicast::hops, multicast::hops, multicast::enable_loopback):
Change access of base class and static data members. Add
using-declaration for __socket_crtp::operator=(_Tp).
(multicast::__mcastopt): New type.
(multicast::join_group, multicast::leave_group): Derive from
__mcastopt for common implementation.
* include/experimental/socket: Add comment.
* testsuite/experimental/net/internet/socket/opt.cc: New test.
* testsuite/experimental/net/socket/socket_base.cc: Check for
protected constructor/destructor of socket_base. Check for
explicit constructors of socket option classes.
libstdc++-v3/include/experimental/internet
libstdc++-v3/include/experimental/socket
libstdc++-v3/testsuite/experimental/net/internet/socket/opt.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/net/socket/socket_base.cc