Description
using llvm/clang main built on 2022-07-14.
There appears to be a regression in how coroutine return objects are implicitly converted prior to returning them.
First as background, the get_return_object
customization point is allowed to return an object that can be implicitly converted to the real return type. This part is still working fine.
The regression concerns when this implicit conversion happens.
Clang traditionally waited to perform this implicit conversion until after the return_value
customization point was called. This allowed doing some tricks that are useful in implementing e.g. a std::optional
coroutine. So if you were to print out the order of calls, it would looks like this traditionally:
- call
get_return_object
- call
return_value
- do implicit conversion of return object to the type that is actually needed.
This may have changed at some point in the last few months, but the version of clang that I built today does it in a different order:
- call
get_return object
- do implicit conversion of return object to the type that is actually needed.
- call
return_value
I'm not sure if the standard guarantees that it will happen in a certain order... but I know that traditionally it used to be done according to the first ordering (which gcc also does), but now that changed, and it is breaking my implementation of the std::optional
coroutine.
It seems sensible to wait as long as possible to perform the implicit conversion, since it affords flexibility to the user in that it permits the object that get_return_object
returns to remain alive and accessible to return_value
(or other customization point methods) until the very end when it is implicitly converted just before ending the coroutine.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status