Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile Warnings : -Wmismatched-new-delete #2

Open
MBO-Intraffic opened this issue Nov 19, 2024 · 7 comments
Open

Compile Warnings : -Wmismatched-new-delete #2

MBO-Intraffic opened this issue Nov 19, 2024 · 7 comments

Comments

@MBO-Intraffic
Copy link

MBO-Intraffic commented Nov 19, 2024

I successfully created a SMPP client with your code.
But I get a couple of '-Wmismatched-new-delete' warnings which I think are too serious to ignore.

Steps taken:
I removed the FMT library form the example/client.
I only build the client
I build under Redhat 8

I tried the same under Ubuntu with boost 1.86.0 but I get more problems.

This is build output:

TDEVTEST-DEUV01 [dei@localhost smpp]$ mkdir build
TDEVTEST-DEUV01 [dei@localhost smpp]$ cd build/
TDEVTEST-DEUV01 [dei@localhost build]$ cmake ..
-- The CXX compiler identification is GNU 12.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/gcc-toolset-12/root/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Boost: /opt/boost_1_83_0/lib/cmake/Boost-1.83.0/BoostConfig.cmake (found suitable version "1.83.0", minimum required is "1.81")  
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/repos/smpp/smpp/build
TDEVTEST-DEUV01 [dei@localhost build]$ cmake --build .
[ 25%] Building CXX object example/CMakeFiles/client.dir/client.cpp.o
In file included from /opt/repos/smpp/smpp/include/smpp/net.hpp:10,
                 from /opt/repos/smpp/smpp/include/smpp.hpp:8,
                 from /opt/repos/smpp/smpp/example/client.cpp:5:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp: In lambda function:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:231:7: warning: ‘static void boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator delete(void*, std::size_t) [with Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, unsigned int), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, unsigned int)>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  231 |       [](auto state, auto* self, auto* const pdu) -> void
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  232 |       {
      |       ~
  233 |         auto command_id      = std::decay_t<decltype(*pdu)>::command_id;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  234 |         auto sequence_number = self->next_sequence_number();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  235 | 
      |        
  236 |         while (!self->send_buf_.empty()) // ongoing send operation
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  237 |         {
      |         ~
  238 |           auto [ec] = co_await self->send_cv_.async_wait(deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  239 |           if (ec != asio::error::operation_aborted || !!state.cancelled())
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  240 |             co_return { ec, {} };
      |             ~~~~~~~~~~~~~~~~~~~~~
  241 |         }
      |         ~
  242 | 
      |        
  243 |         state.reset_cancellation_state(asio::enable_terminal_cancellation());
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  244 | 
      |        
  245 |         auto ec = boost::system::error_code{};
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  246 |         try
      |         ~~~
  247 |         {
      |         ~
  248 |           self->send_buf_.resize(header_length); // reserved for header
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  249 |           serialize_to(&self->send_buf_, *pdu);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  250 |           auto header_buf = std::span<uint8_t, header_length>{ self->send_buf_ };
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  251 |           detail::serialize_header(header_buf, self->send_buf_.size(), command_id, sequence_number);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  252 |           auto [wec, _] = co_await asio::async_write(self->socket_, asio::buffer(self->send_buf_), deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  253 |           ec            = wec;
      |           ~~~~~~~~~~~~~~~~~~~~
  254 |         }
      |         ~
  255 |         catch (const std::exception&)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  256 |         {
      |         ~
  257 |           ec = error::serialization_failed;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  258 |         }
      |         ~
  259 | 
      |        
  260 |         self->send_buf_.clear();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~
  261 |         self->send_cv_.cancel_one();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  262 |         co_return { ec, sequence_number };
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  263 |       },
      |       ~
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:231:7: note: returned from ‘static void* boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator new(std::size_t, C&&, boost::asio::experimental::detail::co_composed_state<Executors, Handler, Return>&, Args&& ...) [with C = const smpp::session::async_send<smpp::bind_transceiver, const boost::asio::deferred_t&>(const smpp::bind_transceiver&, const boost::asio::deferred_t&)::<lambda(auto:62, auto:63*, auto:64*)>&; Args = {smpp::session*&, const smpp::bind_transceiver* const&}; Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, unsigned int), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, unsigned int)>]’
/opt/repos/smpp/smpp/include/smpp/net/session.hpp: In lambda function:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:328:7: warning: ‘static void boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator delete(void*, std::size_t) [with Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status)>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  328 |       [](auto state, auto* self) -> void
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  329 |       {
      |       ~
  330 |         for (auto needs_more = false, needs_post = true, pending_enquire_link = false;;)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  331 |         {
      |         ~
  332 |           using enum command_id;
      |           ~~~~~~~~~~~~~~~~~~~~~~
  333 | 
      |        
  334 |           if (needs_more)
      |           ~~~~~~~~~~~~~~~
  335 |           {
      |           ~
  336 |             self->enquire_link_timer_.expires_after(self->enquire_link_interval_);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  337 |             auto [order, receive_ec, received, timer_ec] =
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  338 |               co_await asio::experimental::make_parallel_group(
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  339 |                 [&](auto token) { return self->socket_.async_receive(self->receive_buf_.prepare(64 * 1024), token); },
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  340 |                 [&](auto token) { return self->enquire_link_timer_.async_wait(token); })
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  341 |                 .async_wait(asio::experimental::wait_for_one(), deferred_tuple);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  342 | 
      |        
  343 |             needs_post = false;
      |             ~~~~~~~~~~~~~~~~~~~
  344 |             needs_more = false;
      |             ~~~~~~~~~~~~~~~~~~~
  345 |             self->receive_buf_.commit(received);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  346 | 
      |        
  347 |             if (order[0] == 0) // receive completed first
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  348 |             {
      |             ~
  349 |               pending_enquire_link = false;
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  350 |               if (receive_ec)
      |               ~~~~~~~~~~~~~~~
  351 |                 co_return { receive_ec, {}, {}, {} };
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  352 |             }
      |             ~
  353 |             else if (pending_enquire_link)
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  354 |             {
      |             ~
  355 |               co_await self->async_send_command(unbind, self->next_sequence_number(), deferred_tuple);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  356 |               self->shutdown_socket();
      |               ~~~~~~~~~~~~~~~~~~~~~~~~
  357 |               co_return { error::enquire_link_timeout, {}, {}, {} };
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  358 |             }
      |             ~
  359 |             else
      |             ~~~~
  360 |             {
      |             ~
  361 |               pending_enquire_link = true;
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  362 |               co_await self->async_send_command(enquire_link, self->next_sequence_number(), deferred_tuple);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  363 |             }
      |             ~
  364 |           }
      |           ~
  365 | 
      |        
  366 |           if (self->receive_buf_.size() < header_length)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  367 |           {
      |           ~
  368 |             needs_more = true;
      |             ~~~~~~~~~~~~~~~~~~
  369 |             continue;
      |             ~~~~~~~~~
  370 |           }
      |           ~
  371 | 
      |        
  372 |           auto header_buf = std::span<const uint8_t, header_length>{ self->receive_buf_ };
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  373 |           auto [command_length, command_id, command_status, sequence_number] = detail::deserialize_header(header_buf);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  374 | 
      |        
  375 |           if (self->receive_buf_.size() < command_length)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  376 |           {
      |           ~
  377 |             needs_more = true;
      |             ~~~~~~~~~~~~~~~~~~
  378 |             continue;
      |             ~~~~~~~~~
  379 |           }
      |           ~
  380 | 
      |        
  381 |           if (command_id == enquire_link)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  382 |           {
      |           ~
  383 |             co_await self->async_send_command(enquire_link_resp, sequence_number, deferred_tuple);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  384 |             self->receive_buf_.consume(command_length);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  385 |           }
      |           ~
  386 |           else if (command_id == enquire_link_resp)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  387 |           {
      |           ~
  388 |             self->receive_buf_.consume(command_length);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  389 |           }
      |           ~
  390 |           else if (command_id == unbind || command_id == unbind_resp)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  391 |           {
      |           ~
  392 |             if (command_id == unbind)
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~
  393 |             {
      |             ~
  394 |               auto [ec] = co_await self->async_send_command(unbind_resp, sequence_number, deferred_tuple);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  395 |               if (ec)
      |               ~~~~~~~
  396 |                 co_return { ec, {}, {}, {} };
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  397 |             }
      |             ~
  398 |             self->shutdown_socket();
      |             ~~~~~~~~~~~~~~~~~~~~~~~~
  399 |             self->receive_buf_.consume(command_length);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  400 |             co_return { error::unbinded, {}, {}, {} };
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  401 |           }
      |           ~
  402 |           else
      |           ~~~~
  403 |           {
      |           ~
  404 |             auto body_buf =
      |             ~~~~~~~~~~~~~~~
  405 |               std::span{ self->receive_buf_.begin() + header_length, self->receive_buf_.begin() + command_length };
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  406 |             auto pdu = pdu_variant{};
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~
  407 |             try
      |             ~~~
  408 |             {
      |             ~
  409 |               [&, command_id = command_id ]<std::size_t... Is>(std::index_sequence<Is...>)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  410 |               {
      |               ~
  411 |                 if (!((command_id == std::decay_t<decltype(std::get<Is>(pdu_variant{}))>::command_id
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  412 |                          ? (pdu = deserialize<std::decay_t<decltype(std::get<Is>(pdu_variant{}))>>(body_buf), true)
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  413 |                          : false) ||
      |                          ~~~~~~~~~~~
  414 |                       ...))
      |                       ~~~~~
  415 |                   throw std::logic_error{ "Unknown PDU" };
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  416 |               }
      |               ~
  417 |               (std::make_index_sequence<std::variant_size_v<pdu_variant> - 1>()); // -1 because of invalid_pdu
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  418 |             }
      |             ~
  419 |             catch (const std::exception& e)
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  420 |             {
      |             ~
  421 |               pdu =
      |               ~~~~~
  422 |                 invalid_pdu{ { self->receive_buf_.begin(), self->receive_buf_.begin() + command_length }, e.what() };
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  423 |             }
      |             ~
  424 |             self->receive_buf_.consume(command_length);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  425 |             if (needs_post) // prevents stack growth
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  426 |               co_await asio::post(state.get_io_executor(), asio::deferred);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  427 |             co_return { {}, std::move(pdu), sequence_number, command_status };
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  428 |           }
      |           ~
  429 |         }
      |         ~
  430 |       },
      |       ~
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:328:7: note: returned from ‘static void* boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator new(std::size_t, C&&, boost::asio::experimental::detail::co_composed_state<Executors, Handler, Return>&, Args&& ...) [with C = const smpp::session::async_receive<const boost::asio::deferred_t&>(const boost::asio::deferred_t&)::<lambda(auto:74, auto:75*)>&; Args = {smpp::session*&}; Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status)>]’
/opt/repos/smpp/smpp/include/smpp/net/session.hpp: In lambda function:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:231:7: warning: ‘static void boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator delete(void*, std::size_t) [with Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, unsigned int), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, unsigned int)>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  231 |       [](auto state, auto* self, auto* const pdu) -> void
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  232 |       {
      |       ~
  233 |         auto command_id      = std::decay_t<decltype(*pdu)>::command_id;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  234 |         auto sequence_number = self->next_sequence_number();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  235 | 
      |        
  236 |         while (!self->send_buf_.empty()) // ongoing send operation
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  237 |         {
      |         ~
  238 |           auto [ec] = co_await self->send_cv_.async_wait(deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  239 |           if (ec != asio::error::operation_aborted || !!state.cancelled())
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  240 |             co_return { ec, {} };
      |             ~~~~~~~~~~~~~~~~~~~~~
  241 |         }
      |         ~
  242 | 
      |        
  243 |         state.reset_cancellation_state(asio::enable_terminal_cancellation());
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  244 | 
      |        
  245 |         auto ec = boost::system::error_code{};
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  246 |         try
      |         ~~~
  247 |         {
      |         ~
  248 |           self->send_buf_.resize(header_length); // reserved for header
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  249 |           serialize_to(&self->send_buf_, *pdu);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  250 |           auto header_buf = std::span<uint8_t, header_length>{ self->send_buf_ };
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  251 |           detail::serialize_header(header_buf, self->send_buf_.size(), command_id, sequence_number);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  252 |           auto [wec, _] = co_await asio::async_write(self->socket_, asio::buffer(self->send_buf_), deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  253 |           ec            = wec;
      |           ~~~~~~~~~~~~~~~~~~~~
  254 |         }
      |         ~
  255 |         catch (const std::exception&)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  256 |         {
      |         ~
  257 |           ec = error::serialization_failed;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  258 |         }
      |         ~
  259 | 
      |        
  260 |         self->send_buf_.clear();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~
  261 |         self->send_cv_.cancel_one();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  262 |         co_return { ec, sequence_number };
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  263 |       },
      |       ~
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:231:7: note: returned from ‘static void* boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator new(std::size_t, C&&, boost::asio::experimental::detail::co_composed_state<Executors, Handler, Return>&, Args&& ...) [with C = const smpp::session::async_send<smpp::submit_sm, const boost::asio::deferred_t&>(const smpp::submit_sm&, const boost::asio::deferred_t&)::<lambda(auto:62, auto:63*, auto:64*)>&; Args = {smpp::session*&, const smpp::submit_sm* const&}; Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, unsigned int), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, unsigned int)>]’
/opt/repos/smpp/smpp/include/smpp/net/session.hpp: In lambda function:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:198:7: warning: ‘static void boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator delete(void*, std::size_t) [with Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code)>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  198 |       [](auto state, auto* self, auto command_id, auto sequence_number) -> void
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  199 |       {
      |       ~
  200 |         while (!self->send_buf_.empty()) // ongoing send operation
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  201 |         {
      |         ~
  202 |           auto [ec] = co_await self->send_cv_.async_wait(deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  203 |           if (ec != asio::error::operation_aborted || !!state.cancelled())
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  204 |             co_return ec;
      |             ~~~~~~~~~~~~~
  205 |         }
      |         ~
  206 | 
      |        
  207 |         state.reset_cancellation_state(asio::enable_terminal_cancellation());
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  208 | 
      |        
  209 |         self->send_buf_.resize(header_length); // reserved for header
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  210 |         auto header_buf = std::span<uint8_t, header_length>{ self->send_buf_ };
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  211 |         detail::serialize_header(header_buf, header_length, command_id, sequence_number);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  212 |         auto [ec, _] = co_await asio::async_write(self->socket_, asio::buffer(self->send_buf_), deferred_tuple);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  213 | 
      |        
  214 |         self->send_buf_.clear();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~
  215 |         self->send_cv_.cancel_one();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  216 |         co_return ec;
      |         ~~~~~~~~~~~~~
  217 |       },
      |       ~
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:198:7: note: returned from ‘static void* boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator new(std::size_t, C&&, boost::asio::experimental::detail::co_composed_state<Executors, Handler, Return>&, Args&& ...) [with C = const smpp::session::async_send_command<const boost::asio::deferred_t&>(smpp::command_id, uint32_t, const boost::asio::deferred_t&)::<lambda(auto:56, auto:57*, auto:58, auto:59)>&; Args = {smpp::session*&, smpp::command_id&, unsigned int&}; Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code)>]’
/opt/repos/smpp/smpp/include/smpp/net/session.hpp: In lambda function:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:198:7: warning: ‘static void boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator delete(void*, std::size_t) [with Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::as_tuple_handler<boost::asio::experimental::detail::co_composed_handler<void(boost::asio::any_io_executor), boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status), boost::asio::any_io_executor>, boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status)>, void(std::tuple<boost::system::error_code>)> >; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code)>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  198 |       [](auto state, auto* self, auto command_id, auto sequence_number) -> void
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  199 |       {
      |       ~
  200 |         while (!self->send_buf_.empty()) // ongoing send operation
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  201 |         {
      |         ~
  202 |           auto [ec] = co_await self->send_cv_.async_wait(deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  203 |           if (ec != asio::error::operation_aborted || !!state.cancelled())
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  204 |             co_return ec;
      |             ~~~~~~~~~~~~~
  205 |         }
      |         ~
  206 | 
      |        
  207 |         state.reset_cancellation_state(asio::enable_terminal_cancellation());
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  208 | 
      |        
  209 |         self->send_buf_.resize(header_length); // reserved for header
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  210 |         auto header_buf = std::span<uint8_t, header_length>{ self->send_buf_ };
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  211 |         detail::serialize_header(header_buf, header_length, command_id, sequence_number);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  212 |         auto [ec, _] = co_await asio::async_write(self->socket_, asio::buffer(self->send_buf_), deferred_tuple);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  213 | 
      |        
  214 |         self->send_buf_.clear();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~
  215 |         self->send_cv_.cancel_one();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  216 |         co_return ec;
      |         ~~~~~~~~~~~~~
  217 |       },
      |       ~
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:198:7: note: returned from ‘static void* boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator new(std::size_t, C&&, boost::asio::experimental::detail::co_composed_state<Executors, Handler, Return>&, Args&& ...) [with C = const smpp::session::async_send_command<const boost::asio::as_tuple_t<boost::asio::deferred_t>&>(smpp::command_id, uint32_t, const boost::asio::as_tuple_t<boost::asio::deferred_t>&)::<lambda(auto:56, auto:57*, auto:58, auto:59)>&; Args = {smpp::session*&, smpp::command_id&, unsigned int&}; Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::as_tuple_handler<boost::asio::experimental::detail::co_composed_handler<void(boost::asio::any_io_executor), boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status), boost::asio::any_io_executor>, boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status)>, void(std::tuple<boost::system::error_code>)> >; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code)>]’
[ 50%] Linking CXX executable client
[ 50%] Built target client
[ 75%] Building CXX object example/CMakeFiles/server.dir/server.cpp.o
In file included from /opt/repos/smpp/smpp/include/smpp/net.hpp:10,
                 from /opt/repos/smpp/smpp/include/smpp.hpp:8,
                 from /opt/repos/smpp/smpp/example/server.cpp:5:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp: In lambda function:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:328:7: warning: ‘static void boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator delete(void*, std::size_t) [with Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status)>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  328 |       [](auto state, auto* self) -> void
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  329 |       {
      |       ~
  330 |         for (auto needs_more = false, needs_post = true, pending_enquire_link = false;;)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  331 |         {
      |         ~
  332 |           using enum command_id;
      |           ~~~~~~~~~~~~~~~~~~~~~~
  333 | 
      |        
  334 |           if (needs_more)
      |           ~~~~~~~~~~~~~~~
  335 |           {
      |           ~
  336 |             self->enquire_link_timer_.expires_after(self->enquire_link_interval_);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  337 |             auto [order, receive_ec, received, timer_ec] =
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  338 |               co_await asio::experimental::make_parallel_group(
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  339 |                 [&](auto token) { return self->socket_.async_receive(self->receive_buf_.prepare(64 * 1024), token); },
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  340 |                 [&](auto token) { return self->enquire_link_timer_.async_wait(token); })
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  341 |                 .async_wait(asio::experimental::wait_for_one(), deferred_tuple);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  342 | 
      |        
  343 |             needs_post = false;
      |             ~~~~~~~~~~~~~~~~~~~
  344 |             needs_more = false;
      |             ~~~~~~~~~~~~~~~~~~~
  345 |             self->receive_buf_.commit(received);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  346 | 
      |        
  347 |             if (order[0] == 0) // receive completed first
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  348 |             {
      |             ~
  349 |               pending_enquire_link = false;
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  350 |               if (receive_ec)
      |               ~~~~~~~~~~~~~~~
  351 |                 co_return { receive_ec, {}, {}, {} };
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  352 |             }
      |             ~
  353 |             else if (pending_enquire_link)
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  354 |             {
      |             ~
  355 |               co_await self->async_send_command(unbind, self->next_sequence_number(), deferred_tuple);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  356 |               self->shutdown_socket();
      |               ~~~~~~~~~~~~~~~~~~~~~~~~
  357 |               co_return { error::enquire_link_timeout, {}, {}, {} };
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  358 |             }
      |             ~
  359 |             else
      |             ~~~~
  360 |             {
      |             ~
  361 |               pending_enquire_link = true;
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  362 |               co_await self->async_send_command(enquire_link, self->next_sequence_number(), deferred_tuple);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  363 |             }
      |             ~
  364 |           }
      |           ~
  365 | 
      |        
  366 |           if (self->receive_buf_.size() < header_length)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  367 |           {
      |           ~
  368 |             needs_more = true;
      |             ~~~~~~~~~~~~~~~~~~
  369 |             continue;
      |             ~~~~~~~~~
  370 |           }
      |           ~
  371 | 
      |        
  372 |           auto header_buf = std::span<const uint8_t, header_length>{ self->receive_buf_ };
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  373 |           auto [command_length, command_id, command_status, sequence_number] = detail::deserialize_header(header_buf);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  374 | 
      |        
  375 |           if (self->receive_buf_.size() < command_length)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  376 |           {
      |           ~
  377 |             needs_more = true;
      |             ~~~~~~~~~~~~~~~~~~
  378 |             continue;
      |             ~~~~~~~~~
  379 |           }
      |           ~
  380 | 
      |        
  381 |           if (command_id == enquire_link)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  382 |           {
      |           ~
  383 |             co_await self->async_send_command(enquire_link_resp, sequence_number, deferred_tuple);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  384 |             self->receive_buf_.consume(command_length);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  385 |           }
      |           ~
  386 |           else if (command_id == enquire_link_resp)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  387 |           {
      |           ~
  388 |             self->receive_buf_.consume(command_length);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  389 |           }
      |           ~
  390 |           else if (command_id == unbind || command_id == unbind_resp)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  391 |           {
      |           ~
  392 |             if (command_id == unbind)
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~
  393 |             {
      |             ~
  394 |               auto [ec] = co_await self->async_send_command(unbind_resp, sequence_number, deferred_tuple);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  395 |               if (ec)
      |               ~~~~~~~
  396 |                 co_return { ec, {}, {}, {} };
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  397 |             }
      |             ~
  398 |             self->shutdown_socket();
      |             ~~~~~~~~~~~~~~~~~~~~~~~~
  399 |             self->receive_buf_.consume(command_length);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  400 |             co_return { error::unbinded, {}, {}, {} };
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  401 |           }
      |           ~
  402 |           else
      |           ~~~~
  403 |           {
      |           ~
  404 |             auto body_buf =
      |             ~~~~~~~~~~~~~~~
  405 |               std::span{ self->receive_buf_.begin() + header_length, self->receive_buf_.begin() + command_length };
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  406 |             auto pdu = pdu_variant{};
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~
  407 |             try
      |             ~~~
  408 |             {
      |             ~
  409 |               [&, command_id = command_id ]<std::size_t... Is>(std::index_sequence<Is...>)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  410 |               {
      |               ~
  411 |                 if (!((command_id == std::decay_t<decltype(std::get<Is>(pdu_variant{}))>::command_id
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  412 |                          ? (pdu = deserialize<std::decay_t<decltype(std::get<Is>(pdu_variant{}))>>(body_buf), true)
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  413 |                          : false) ||
      |                          ~~~~~~~~~~~
  414 |                       ...))
      |                       ~~~~~
  415 |                   throw std::logic_error{ "Unknown PDU" };
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  416 |               }
      |               ~
  417 |               (std::make_index_sequence<std::variant_size_v<pdu_variant> - 1>()); // -1 because of invalid_pdu
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  418 |             }
      |             ~
  419 |             catch (const std::exception& e)
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  420 |             {
      |             ~
  421 |               pdu =
      |               ~~~~~
  422 |                 invalid_pdu{ { self->receive_buf_.begin(), self->receive_buf_.begin() + command_length }, e.what() };
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  423 |             }
      |             ~
  424 |             self->receive_buf_.consume(command_length);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  425 |             if (needs_post) // prevents stack growth
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  426 |               co_await asio::post(state.get_io_executor(), asio::deferred);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  427 |             co_return { {}, std::move(pdu), sequence_number, command_status };
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  428 |           }
      |           ~
  429 |         }
      |         ~
  430 |       },
      |       ~
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:328:7: note: returned from ‘static void* boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator new(std::size_t, C&&, boost::asio::experimental::detail::co_composed_state<Executors, Handler, Return>&, Args&& ...) [with C = const smpp::session::async_receive<const boost::asio::deferred_t&>(const boost::asio::deferred_t&)::<lambda(auto:74, auto:75*)>&; Args = {smpp::session*&}; Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status)>]’
/opt/repos/smpp/smpp/include/smpp/net/session.hpp: In lambda function:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:278:7: warning: ‘static void boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator delete(void*, std::size_t) [with Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code)>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  278 |       [](auto state, auto* self, auto* const pdu, auto sequence_number, auto command_status) -> void
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  279 |       {
      |       ~
  280 |         auto command_id = std::decay_t<decltype(*pdu)>::command_id;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  281 | 
      |        
  282 |         while (!self->send_buf_.empty()) // ongoing send operation
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  283 |         {
      |         ~
  284 |           auto [ec] = co_await self->send_cv_.async_wait(deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  285 |           if (ec != asio::error::operation_aborted || !!state.cancelled())
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  286 |             co_return ec;
      |             ~~~~~~~~~~~~~
  287 |         }
      |         ~
  288 | 
      |        
  289 |         state.reset_cancellation_state(asio::enable_terminal_cancellation());
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  290 | 
      |        
  291 |         auto ec = boost::system::error_code{};
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  292 |         try
      |         ~~~
  293 |         {
      |         ~
  294 |           self->send_buf_.resize(header_length); // reserved for header
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  295 |           serialize_to(&self->send_buf_, *pdu);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  296 |           auto header_buf = std::span<uint8_t, header_length>{ self->send_buf_ };
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  297 |           detail::serialize_header(header_buf, self->send_buf_.size(), command_id, sequence_number, command_status);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  298 |           auto [wec, _] = co_await asio::async_write(self->socket_, asio::buffer(self->send_buf_), deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  299 |           ec            = wec;
      |           ~~~~~~~~~~~~~~~~~~~~
  300 |         }
      |         ~
  301 |         catch (const std::exception&)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  302 |         {
      |         ~
  303 |           ec = error::serialization_failed;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  304 |         }
      |         ~
  305 | 
      |        
  306 |         self->send_buf_.clear();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~
  307 |         self->send_cv_.cancel_one();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  308 |         co_return ec;
      |         ~~~~~~~~~~~~~
  309 |       },
      |       ~
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:278:7: note: returned from ‘static void* boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator new(std::size_t, C&&, boost::asio::experimental::detail::co_composed_state<Executors, Handler, Return>&, Args&& ...) [with C = const smpp::session::async_send<smpp::bind_transceiver_resp, const boost::asio::deferred_t&>(const smpp::bind_transceiver_resp&, uint32_t, smpp::command_status, const boost::asio::deferred_t&)::<lambda(auto:67, auto:68*, auto:69*, auto:70, auto:71)>&; Args = {smpp::session*&, const smpp::bind_transceiver_resp* const&, unsigned int&, smpp::command_status&}; Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code)>]’
/opt/repos/smpp/smpp/include/smpp/net/session.hpp: In lambda function:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:278:7: warning: ‘static void boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator delete(void*, std::size_t) [with Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code)>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  278 |       [](auto state, auto* self, auto* const pdu, auto sequence_number, auto command_status) -> void
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  279 |       {
      |       ~
  280 |         auto command_id = std::decay_t<decltype(*pdu)>::command_id;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  281 | 
      |        
  282 |         while (!self->send_buf_.empty()) // ongoing send operation
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  283 |         {
      |         ~
  284 |           auto [ec] = co_await self->send_cv_.async_wait(deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  285 |           if (ec != asio::error::operation_aborted || !!state.cancelled())
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  286 |             co_return ec;
      |             ~~~~~~~~~~~~~
  287 |         }
      |         ~
  288 | 
      |        
  289 |         state.reset_cancellation_state(asio::enable_terminal_cancellation());
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  290 | 
      |        
  291 |         auto ec = boost::system::error_code{};
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  292 |         try
      |         ~~~
  293 |         {
      |         ~
  294 |           self->send_buf_.resize(header_length); // reserved for header
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  295 |           serialize_to(&self->send_buf_, *pdu);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  296 |           auto header_buf = std::span<uint8_t, header_length>{ self->send_buf_ };
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  297 |           detail::serialize_header(header_buf, self->send_buf_.size(), command_id, sequence_number, command_status);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  298 |           auto [wec, _] = co_await asio::async_write(self->socket_, asio::buffer(self->send_buf_), deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  299 |           ec            = wec;
      |           ~~~~~~~~~~~~~~~~~~~~
  300 |         }
      |         ~
  301 |         catch (const std::exception&)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  302 |         {
      |         ~
  303 |           ec = error::serialization_failed;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  304 |         }
      |         ~
  305 | 
      |        
  306 |         self->send_buf_.clear();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~
  307 |         self->send_cv_.cancel_one();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  308 |         co_return ec;
      |         ~~~~~~~~~~~~~
  309 |       },
      |       ~
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:278:7: note: returned from ‘static void* boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator new(std::size_t, C&&, boost::asio::experimental::detail::co_composed_state<Executors, Handler, Return>&, Args&& ...) [with C = const smpp::session::async_send<smpp::submit_sm_resp, const boost::asio::deferred_t&>(const smpp::submit_sm_resp&, uint32_t, smpp::command_status, const boost::asio::deferred_t&)::<lambda(auto:67, auto:68*, auto:69*, auto:70, auto:71)>&; Args = {smpp::session*&, const smpp::submit_sm_resp* const&, unsigned int&, smpp::command_status&}; Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code), boost::asio::any_io_executor>; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code)>]’
/opt/repos/smpp/smpp/include/smpp/net/session.hpp: In lambda function:
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:198:7: warning: ‘static void boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator delete(void*, std::size_t) [with Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::as_tuple_handler<boost::asio::experimental::detail::co_composed_handler<void(boost::asio::any_io_executor), boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status), boost::asio::any_io_executor>, boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status)>, void(std::tuple<boost::system::error_code>)> >; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code)>]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  198 |       [](auto state, auto* self, auto command_id, auto sequence_number) -> void
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  199 |       {
      |       ~
  200 |         while (!self->send_buf_.empty()) // ongoing send operation
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  201 |         {
      |         ~
  202 |           auto [ec] = co_await self->send_cv_.async_wait(deferred_tuple);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  203 |           if (ec != asio::error::operation_aborted || !!state.cancelled())
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  204 |             co_return ec;
      |             ~~~~~~~~~~~~~
  205 |         }
      |         ~
  206 | 
      |        
  207 |         state.reset_cancellation_state(asio::enable_terminal_cancellation());
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  208 | 
      |        
  209 |         self->send_buf_.resize(header_length); // reserved for header
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  210 |         auto header_buf = std::span<uint8_t, header_length>{ self->send_buf_ };
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  211 |         detail::serialize_header(header_buf, header_length, command_id, sequence_number);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  212 |         auto [ec, _] = co_await asio::async_write(self->socket_, asio::buffer(self->send_buf_), deferred_tuple);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  213 | 
      |        
  214 |         self->send_buf_.clear();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~
  215 |         self->send_cv_.cancel_one();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  216 |         co_return ec;
      |         ~~~~~~~~~~~~~
  217 |       },
      |       ~
/opt/repos/smpp/smpp/include/smpp/net/session.hpp:198:7: note: returned from ‘static void* boost::asio::experimental::detail::co_composed_promise<Executors, Handler, Return>::operator new(std::size_t, C&&, boost::asio::experimental::detail::co_composed_state<Executors, Handler, Return>&, Args&& ...) [with C = const smpp::session::async_send_command<const boost::asio::as_tuple_t<boost::asio::deferred_t>&>(smpp::command_id, uint32_t, const boost::asio::as_tuple_t<boost::asio::deferred_t>&)::<lambda(auto:56, auto:57*, auto:58, auto:59)>&; Args = {smpp::session*&, smpp::command_id&, unsigned int&}; Executors = void(boost::asio::any_io_executor); Handler = boost::asio::detail::as_tuple_handler<boost::asio::experimental::detail::co_composed_handler<void(boost::asio::any_io_executor), boost::asio::detail::awaitable_async_op_handler<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status), boost::asio::any_io_executor>, boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code, std::variant<smpp::alert_notification, smpp::bind_receiver, smpp::bind_receiver_resp, smpp::bind_transceiver, smpp::bind_transceiver_resp, smpp::bind_transmitter, smpp::bind_transmitter_resp, smpp::cancel_sm, smpp::cancel_sm_resp, smpp::data_sm, smpp::data_sm_resp, smpp::deliver_sm, smpp::deliver_sm_resp, smpp::generic_nack, smpp::outbind, smpp::query_sm, smpp::query_sm_resp, smpp::replace_sm, smpp::replace_sm_resp, smpp::submit_sm, smpp::submit_sm_resp, smpp::invalid_pdu>, unsigned int, smpp::command_status)>, void(std::tuple<boost::system::error_code>)> >; Return = boost::asio::experimental::detail::co_composed_returns<void(boost::system::error_code)>]’
[100%] Linking CXX executable server
[100%] Built target server
@ashtum
Copy link
Owner

ashtum commented Nov 19, 2024

This is a known false positive warning from GCC. There will be no warning if you compile it using Clang.

@MBO-Intraffic
Copy link
Author

Ok, thank you for the fast response!
Unfortunately, we use GCC and normally use a no warnings policy.

I searched the internet for some information but did not find that conclusion.
Do you know a link to the 'known false positive warning' list?

Any tips how to get rid of it (besides switching compilers) ?

@ashtum
Copy link
Owner

ashtum commented Nov 19, 2024

Yes, I remember investigating it thoroughly at the time but couldn’t find any explanation. There’s a chance it might go away if I replace the lambda with a function object. Let me check.

@ashtum
Copy link
Owner

ashtum commented Nov 19, 2024

No, changing the lambda to a function object didn't make any difference. Here's a similar issue report: boostorg/cobalt#7.
The only option would be to disable -Wmismatched-new-delete in that particular header file.

@MBO-Intraffic
Copy link
Author

MBO-Intraffic commented Nov 19, 2024

Thank you for trying!
Ik will have a deeper look at the boostorg issue.

For now I will use the disable -Wmismatched-new-delete option and do some memory tests to make sure.

Just to 'boost' my personal C++ knowledge (and others), could you share the function object code you tried?
I was looking into that but I found I needed a lot more study

@ashtum
Copy link
Owner

ashtum commented Nov 19, 2024

Just to 'boost' my personal C++ knowledge (and others), could you share the function object code you tried?
I was looking into that but I found I needed a lot more study

I was referring to those lambdas that are used as the coroutine body inside asio::experimental::co_composed:

    asio::experimental::co_composed<void(boost::system::error_code)>(
      [](auto state, auto* self, auto command_id, auto sequence_number) -> void
      {
        while (!self->send_buf_.empty()) // ongoing send operation
        {
          auto [ec] = co_await self->send_cv_.async_wait(deferred_tuple);
          if (ec != asio::error::operation_aborted || !!state.cancelled())
            co_return ec;
        }

        state.reset_cancellation_state(asio::enable_terminal_cancellation());

        self->send_buf_.resize(header_length); // reserved for header
        auto header_buf = std::span<uint8_t, header_length>{ self->send_buf_ };
        detail::serialize_header(header_buf, header_length, command_id, sequence_number);
        auto [ec, _] = co_await asio::async_write(self->socket_, asio::buffer(self->send_buf_), deferred_tuple);

        self->send_buf_.clear();
        self->send_cv_.cancel_one();
        co_return ec;
      },
      socket_)

I was wondering if replacing them with a function object would make any difference like:

struct op
{
  void
  operator()(auto state, auto* self, auto command_id, auto sequence_number)
  {
    // ...
  }
};

Which didn't make any difference.

@ashtum
Copy link
Owner

ashtum commented Nov 22, 2024

@MBO-Intraffic I've adjusted the code to use Asio faux-coroutines instead of co_composed, and all warnings are resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants