asio icon indicating copy to clipboard operation
asio copied to clipboard

[experimental::coro] asserts for equality with noop_coroutine() are not correct

Open andrei-datcu opened this issue 3 years ago • 5 comments

Ex: https://github.com/chriskohlhoff/asio/blob/8869d25/asio/include/asio/experimental/impl/coro.hpp#L1014

According to cppreference:

Return values from different calls to noop_coroutine may and may not compare equal.

Would assert(!coro->awaited_from) suffice?

cc @klemens-morgenstern

andrei-datcu avatar Jun 07 '22 21:06 andrei-datcu

Does the noop_coroutine equate to false?

klemens-morgenstern avatar Jun 11 '22 07:06 klemens-morgenstern

No, it does not, sorry for the confusion.

To give more context to my original problem:

I stumbled upon this when compiling my code with -Og. Running on clang14 + libcpp14 I got the asserts erroneously triggered.

andrei-datcu avatar Jun 11 '22 07:06 andrei-datcu

The assert just shouldn't be there, it's left over from development.

klemens-morgenstern avatar Jun 11 '22 15:06 klemens-morgenstern

@klemens-morgenstern All asserts or not?

https://github.com/chriskohlhoff/asio/blob/8869d25ae2c7eb280ee6048e86b4e3d44f257323/asio/include/asio/experimental/impl/coro.hpp#L1014

https://github.com/chriskohlhoff/asio/blob/8869d25ae2c7eb280ee6048e86b4e3d44f257323/asio/include/asio/experimental/impl/coro.hpp#L1036

https://github.com/chriskohlhoff/asio/blob/8869d25ae2c7eb280ee6048e86b4e3d44f257323/asio/include/asio/experimental/impl/coro.hpp#L1086

https://github.com/chriskohlhoff/asio/blob/8869d25ae2c7eb280ee6048e86b4e3d44f257323/asio/include/asio/experimental/impl/coro.hpp#L1138

phprus avatar Jun 11 '22 16:06 phprus

All of them are faulty.

klemens-morgenstern avatar Jun 11 '22 17:06 klemens-morgenstern