coro::task<T> expects T to be default-constructible even if the default constructor is never used
LordTermor opened this issue · 2 comments
LordTermor commented
I don't know if it's intended and couldn't find any discussion regarding this.
struct A {
A(int bar) {} //no default constructor
};
coro::task<A> foo() {
co_return A(2);
} // doesn't compile
Seems the promise
type needs default-constructed m_return_value
.
Line 120 in 6a631de
jbaldwin commented
Hey @LordTermor, thanks for reporting this problem, this is indeed a bug. I've pushed a PR which addresses the issue and adds a test to verify that the code you submitted compiles. Can you please take a look and try it out? Thanks.
LordTermor commented
Hey. Thank you! Works flawlessly on my side.