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

            Bug ID: 121851
           Summary: ICE: in ocp_convert, at cp/cvt.cc:802
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stevenxia990430 at gmail dot com
  Target Milestone: ---

The following program successfully compiles on Clang but reports an internal
compiler error: in ocp_convert, at cp/cvt.cc:802. Failed on gcc-trunk. 

To quickly reproduce: https://gcc.godbolt.org/z/EMnK3q8Ts
```
#include <exception>
#include <coroutine>

template<typename T>
struct Generator {
    struct promise_type {
        T current_value;
        std::suspend_always yield_value(T value) {
            current_value = value;
            return {};
        }
        std::suspend_always initial_suspend() { return {}; }
        std::suspend_always final_suspend() noexcept { return {}; }
        Generator get_return_object() { return
Generator{std::coroutine_handle<promise_type>::from_promise(*this)}; }
        void unhandled_exception() { std::terminate(); }
        void return_void() {}
    };

    using handle_type = std::coroutine_handle<promise_type>;
    handle_type coro;
    Generator(handle_type h) : coro(h) {}
    ~Generator() { if (coro) coro.destroy(); }
};

Generator<int> const d(int n) {
    int a = 0;
    co_yield a;
}

int main() {
    return 0;
}
```
  • [Bug c++/121851] New: ICE: i... stevenxia990430 at gmail dot com via Gcc-bugs

Reply via email to