// { dg-do run } // { dg-output "coroutine name: MyFoo" } // { dg-skip-if "requires hosted libstdc++ for cstdio" { ! hostedlib } } #include #include struct pt { using handle_t = std::coroutine_handle; auto get_return_object() noexcept { return handle_t::from_promise(*this); } std::suspend_never initial_suspend () const noexcept { return {}; } std::suspend_never final_suspend () const noexcept { return {}; } void return_void() const noexcept {} void unhandled_exception() const noexcept {} }; template <> struct std::coroutine_traits { using promise_type = pt; }; static pt::handle_t MyFoo () { printf ("coroutine name: %s\n", __builtin_FUNCTION()); co_return; } int main() { MyFoo (); }