https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118903

--- Comment #2 from Hana Dusíková <hanicka at hanicka dot net> ---
https://compiler-explorer.com/z/58reoonEW

(trunk GCC 2ef2b206c4617abae60002280455f7175aaa6064)

```c++
#include <coroutine>

struct awaitable {
    constexpr bool await_ready() {
        return true;
    }
    void await_suspend(std::coroutine_handle<void>) {

    }
    constexpr int await_resume() {
        return 42;
    }
};

struct super_simple_coroutine {
    struct promise_type {
        constexpr auto initial_suspend() {
            return std::suspend_never();
        }
        constexpr auto final_suspend() const noexcept {
            return std::suspend_never();
        }
        constexpr void unhandled_exception() {
            // do nothing
        }
        constexpr auto get_return_object() {
            return super_simple_coroutine{};
        }
        constexpr void return_void() {

        }
    };
};

auto fib() -> super_simple_coroutine {
    // if `co_await` is part of BodyStatement of a function
    // it makes it coroutine
    constexpr auto x = co_await awaitable{};
}
```

Reply via email to