asio icon indicating copy to clipboard operation
asio copied to clipboard

any_completion_handler is not compatible with BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT

Open anarthal opened this issue 1 year ago • 1 comments

Minimal reproducible example: https://godbolt.org/z/fE3nGv4vf

This has been reported by a user of Boost.MySQL that is trying to build the library with BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT and failing. Not having this compatibility means that we can't use any_completion_handler in library code.

anarthal avatar Nov 27 '23 12:11 anarthal

It seems that when BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT is defined, Asio utilizes the executor as the any_completion_executor type: https://github.com/chriskohlhoff/asio/blob/fa27820c05afd740fa2adc1ecfb9da5afe026443/asio/include/asio/any_completion_executor.hpp#L31 However, when it attempts to use the noexcept constructor of any_completion_executor : https://github.com/chriskohlhoff/asio/blob/fa27820c05afd740fa2adc1ecfb9da5afe026443/asio/include/asio/any_completion_handler.hpp#L120 since it is an alias of executor type, it lacks such a constructor. If we remove the std::nothrow tag, it works.

ashtum avatar Nov 27 '23 18:11 ashtum