Currently, if a coroutine function is declared noexcept, this triggers std::terminate on alloc fail.

I would like to suggest that if frame construction fails due to memory, the compiler attempts to construct a value of Ret using an instance of std::bad_alloc{} before throwing std::bad_alloc (and calling std::terminate if marked noexcept)

For example:

class coroutine_type
{
   struct promise_type { ... } 
private:
   coroutine_type (promise_type *) { ... }
public:
   coroutine_type(std::bad_alloc) { 
      // Handle here
   }
};

This would allow declaring noexcept coroutine functions like:

coroutine_type myfunc(...) noexcept;



--
Ryan P. Nicholl
Tel: (678)-358-7765