socketwrapper icon indicating copy to clipboard operation
socketwrapper copied to clipboard

Fixed compile error

Open ng88 opened this issue 1 year ago • 1 comments

This commit fixes a compile error with GCC 12.2.0 on Debian 12.4 The error was the following: g++ -o udp_example udp_example.cpp -std=c++17 -fpic -Wall -Werror -Wextra -pedantic -lpthread In file included from ../include/socketwrapper/detail/event_notifier.hpp:7, from ../include/socketwrapper/detail/executor.hpp:5, from ../include/socketwrapper/detail/base_socket.hpp:4, from ../include/socketwrapper/udp.hpp:4, from udp_example.cpp:1: ../include/socketwrapper/detail/event_notifier_epoll.hpp: In member function ‘std::optional<std::pair<int, net::detail::event_type> > net::detail::event_notifier_epoll::next_event()’: ../include/socketwrapper/detail/event_notifier_epoll.hpp:187:61: error: cannot bind packed field ‘ready_set.std::array<epoll_event, 64>::operator[](((std::array<epoll_event, 64>::size_type)i)).epoll_event::data.epoll_data::fd’ to ‘int&’ 187 | return std::make_pair(ready_set[i].data.fd, event_type::READ); ../include/socketwrapper/detail/event_notifier_epoll.hpp:192:61: error: cannot bind packed field ‘ready_set.std::array<epoll_event, 64>::operator[](((std::array<epoll_event, 64>::size_type)i)).epoll_event::data.epoll_data::fd’ to ‘int&’ 192 | return std::make_pair(ready_set[i].data.fd, event_type::WRITE); make: *** [Makefile:31 : udp] Erreur 1

ng88 avatar Jan 22 '24 23:01 ng88

Hey, thanks for your contribution! I think we should also apply the same fix to the event_notifier_kqueue for consistency and to be sure that the error won't happen again when someone tries to compile the lib on macOs using G++.

tglane avatar Jan 24 '24 21:01 tglane