[PATCH] D116204: [C++20] [Coroutines] Allow promise_type to not define return_void or return_value

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 23 08:52:51 PST 2021


Quuxplusone added inline comments.


================
Comment at: clang/test/SemaCXX/coroutines.cpp:987
+//
+// So it isn't ill-formed if the promise doesn't define return_value and return_void. It is just a UB.
+coro<promise_no_return_func> no_return_value_or_return_void() {
----------------
It's not UB; it's //potential// UB.
My understanding is that such a coroutine could still be used:
- if it exits by throwing an exception instead of `co_return`'ing
- if it suspends and then its caller `destroy`s it instead of `resume`ing it

I believe it would be useful to have some actual tests for these scenarios, that would actually run and check that the runtime behavior is correct, or at least check the IR that was generated. Is that possible?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116204/new/

https://reviews.llvm.org/D116204



More information about the cfe-commits mailing list