Hello
Is this a known problem or am I just too stupid?
Since we switched to c++20 in VS2022 with toolset v143, the timers no
longer compile.
We have tested it with VS 17.5.0 and 17.5.4.
Test code:
asio::io_service io;
asio::steady_timer t(io, 1s);
Compiler:
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
error C2665: 'boost::asio::any_io_executor::any_io_executor': no
overloaded function could convert all the argument types
1>\boost\boost_1_81_0\include\boost/asio/impl/any_io_executor.ipp(34,18):
message : could be
'boost::asio::any_io_executor::any_io_executor(std::nullptr_t) noexcept'
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
message : 'boost::asio::any_io_executor::any_io_executor(std::nullptr_t)
noexcept': cannot convert argument 1 from
'boost::asio::io_context::executor_type' to 'std::nullptr_t'
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,37):
message : No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called
1>E:\DitecLibs\Packages\boost\boost_1_81_0\include\boost/asio/any_io_executor.hpp(189,3):
message : or
'boost::asio::any_io_executor::any_io_executor(std::nothrow_t,Executor,constraint::value&&!std::is_base_ofboost::asio::execution::detail::any_executor_base,Executor::value,boost::asio::execution::detail::is_valid_target_executor,std::false_type>::type::value,int>::type)
noexcept'
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
message :
'boost::asio::any_io_executor::any_io_executor(std::nothrow_t,Executor,constraint::value&&!std::is_base_ofboost::asio::execution::detail::any_executor_base,Executor::value,boost::asio::execution::detail::is_valid_target_executor,std::false_type>::type::value,int>::type)
noexcept': expects 3 arguments - 1 provided
1>\boost\boost_1_81_0\include\boost/asio/any_io_executor.hpp(167,3):
message : or
'boost::asio::any_io_executor::any_io_executor(Executor,constraint::value&&!std::is_base_ofboost::asio::execution::detail::any_executor_base,Executor::value,boost::asio::execution::detail::is_valid_target_executor,std::false_type>::type::value,int>::type)'
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
message : Failed to specialize function template
'boost::asio::any_io_executor::any_io_executor(Executor,constraint::value&&!std::is_base_ofboost::asio::execution::detail::any_executor_base,Executor::value,boost::asio::execution::detail::is_valid_target_executor,std::false_type>::type::value,int>::type)'
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
message : With the following template arguments:
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
message : 'Executor=boost::asio::io_context::executor_type'
1>\boost\boost_1_81_0\include\boost/asio/any_io_executor.hpp(134,3):
message : or
'boost::asio::any_io_executor::any_io_executor(std::nothrow_t,OtherAnyExecutor,constraint::value&&std::is_base_ofboost::asio::execution::detail::any_executor_base,Executor::value,boost::asio::execution::detail::supportable_properties<0,void
(boost::asio::execution::context_as_t,boost::asio::execution::detail::blocking::never_t<0>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>)>::is_valid_target<OtherAnyExecutor>,std::false_type>::type::value,int>::type)
noexcept'
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
message :
'boost::asio::any_io_executor::any_io_executor(std::nothrow_t,OtherAnyExecutor,constraint::value&&std::is_base_ofboost::asio::execution::detail::any_executor_base,Executor::value,boost::asio::execution::detail::supportable_properties<0,void
(boost::asio::execution::context_as_t,boost::asio::execution::detail::blocking::never_t<0>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>)>::is_valid_target<OtherAnyExecutor>,std::false_type>::type::value,int>::type)
noexcept': expects 3 arguments - 1 provided
1>\boost\boost_1_81_0\include\boost/asio/any_io_executor.hpp(110,3):
message : or
'boost::asio::any_io_executor::any_io_executor(OtherAnyExecutor,constraint::value&&std::is_base_ofboost::asio::execution::detail::any_executor_base,Executor::value,boost::asio::execution::detail::supportable_properties<0,void
(boost::asio::execution::context_as_t,boost::asio::execution::detail::blocking::never_t<0>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>)>::is_valid_target<OtherAnyExecutor>,std::false_type>::type::value,int>::type)'
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
message : Failed to specialize function template
'boost::asio::any_io_executor::any_io_executor(OtherAnyExecutor,constraint::value&&std::is_base_ofboost::asio::execution::detail::any_executor_base,Executor::value,boost::asio::execution::detail::supportable_properties<0,void
(boost::asio::execution::context_as_t,boost::asio::execution::detail::blocking::never_t<0>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>,boost::asio::execution::prefer_only>)>::is_valid_target<OtherAnyExecutor>,std::false_type>::type::value,int>::type)'
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
message : With the following template arguments:
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
message : 'OtherAnyExecutor=boost::asio::io_context::executor_type'
1>\boost\boost_1_81_0\include\boost/asio/detail/io_object_impl.hpp(59,16):
message : while trying to match the argument list
'(boost::asio::io_context::executor_type)'
1>\boost\boost_1_81_0\include\boost/asio/basic_waitable_timer.hpp(284,1):
message : see reference to function template instantiation
'boost::asio::detail::io_object_impl>,boost::asio::any_io_executor>::io_object_impl<ExecutionContext>(int,int,ExecutionContext
&)' being compiled
1> with
1> [
1> Clock=std::chrono::steady_clock,
1> WaitTraits=boost::asio::wait_traitsstd::chrono::steady_clock,
1> ExecutionContext=boost::asio::io_service
1> ]
1>\boost\boost_1_81_0\include\boost/asio/basic_waitable_timer.hpp(283,12):
message : see reference to function template instantiation
'boost::asio::detail::io_object_impl>,boost::asio::any_io_executor>::io_object_impl<ExecutionContext>(int,int,ExecutionContext
&)' being compiled
1> with
1> [
1> Clock=std::chrono::steady_clock,
1> WaitTraits=boost::asio::wait_traitsstd::chrono::steady_clock,
1> ExecutionContext=boost::asio::io_service
1> ]
1>main.cpp(27,29): message : see reference to function template
instantiation
'boost::asio::basic_waitable_timer::basic_waitable_timerboost::asio::io_service(ExecutionContext
&,const std::chrono::duration<__int64,std::nano> &,int)' being compiled
1> with
1> [
1> Clock=std::chrono::steady_clock,
1> ExecutionContext=boost::asio::io_service
1> ]
1>main.cpp(27,22): message : see reference to function template
instantiation
'boost::asio::basic_waitable_timer::basic_waitable_timerboost::asio::io_service(ExecutionContext
&,const std::chrono::duration<__int64,std::nano> &,int)' being compiled
1> with
1> [
1> Clock=std::chrono::steady_clock,
1> ExecutionContext=boost::asio::io_service
1> ]
What could be the reason for this?
Best regards
Sören