I noticed that Shared::operator bool() appears to be inverted:
Awaitable* get() const;
explicit operator bool() const { return !state_; }
That makes a default-constructed Shared evaluate true, while a constructed Shared with a valid state evaluates false. This is the opposite of the surrounding handle-like API: get() returns nullptr for the empty case, closed() treats an empty Shared as closed, and IntrusivePtr itself uses ptr_ != nullptr for its boolean conversion.
A small example of the observable behavior:
auto shared = Shared([]() -> Task<int> { co_return 42; });
CATCH_CHECK(shared); // currently fails
decltype(shared) empty;
CATCH_CHECK(!empty); // currently fails
I have a small fix with a regression in the existing shared tests.
I noticed that
Shared::operator bool()appears to be inverted:That makes a default-constructed
Sharedevaluate true, while a constructedSharedwith a valid state evaluates false. This is the opposite of the surrounding handle-like API:get()returnsnullptrfor the empty case,closed()treats an emptySharedas closed, andIntrusivePtritself usesptr_ != nullptrfor its boolean conversion.A small example of the observable behavior:
I have a small fix with a regression in the existing shared tests.