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

--- Comment #1 from Kacper Słomiński <kacper.slominski72 at gmail dot com> ---
Was about to report this myself; here is a minimal test case that reproduces
this issue without using any external libraries. It causes a slightly different
ICE in gimplify_expr in gimplify.c:14879 for GCC 11.2, but with small tweaks
you can get the one in transform_local_var_uses as well:

#include <coroutine>

struct coro {
        bool await_ready() { return true; }
        void await_suspend(std::coroutine_handle<>) { }
        int await_resume() { return 0; }

        struct promise_type {
                coro get_return_object() {
                        return {};
                }

                std::suspend_never initial_suspend() {
                        return {};
                }

                std::suspend_never final_suspend() noexcept {
                        return {};
                }

                template <typename T>
                void return_value(T &&) {}

                void unhandled_exception() {}
        };
};

coro fn() { co_return 1; };

coro foo() {
        ({
                auto ex = co_await fn();
                co_return ex;
        });
        co_return 0;
}
  • [Bug c++/102508] ICE on c... kacper.slominski72 at gmail dot com via Gcc-bugs

Reply via email to