https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89461
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This might help, but probably isn't the right fix: --- a/libstdc++-v3/include/experimental/io_context +++ b/libstdc++-v3/include/experimental/io_context @@ -134,7 +134,8 @@ inline namespace v1 io_context* _M_ctx; }; - using count_type = size_t; + using count_type + = conditional_t<atomic<size_t>::is_always_lock_free(), size_t, int>; // construct / copy / destroy: