-
Notifications
You must be signed in to change notification settings - Fork 0
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
Comments
This is a known false positive warning from GCC. There will be no warning if you compile it using Clang. |
Ok, thank you for the fast response! I searched the internet for some information but did not find that conclusion. Any tips how to get rid of it (besides switching compilers) ? |
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. |
No, changing the lambda to a function object didn't make any difference. Here's a similar issue report: boostorg/cobalt#7. |
Thank you for trying! 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 referring to those lambdas that are used as the coroutine body inside 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. |
@MBO-Intraffic I've adjusted the code to use Asio faux-coroutines instead of |
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:
The text was updated successfully, but these errors were encountered: