[Bug c++/94752] New: [coroutines] compiler ICE with coroutine with unnamed parameter

lewissbaker.opensource at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 24 22:33:07 GMT 2020


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

            Bug ID: 94752
           Summary: [coroutines] compiler ICE with coroutine with unnamed
                    parameter
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lewissbaker.opensource at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/QCXqeo

Compile the following source code with GCC trunk.
Flags: -std=c++20 -fcoroutines

-----
#include <coroutine>
using namespace std;

struct task {
    struct promise_type {
        promise_type() {}
        task get_return_object() { return {}; }
        suspend_never initial_suspend() { return {}; }
        suspend_never final_suspend() { return {}; }
        void return_void() {}
        void unhandled_exception() {}
    };
};

task foo(int) {
    co_return;
}
-----

Results in an internal-compile-error - segmentation-fault.
Pointing at closing curly-brace of 'foo()'.

Seems to be related to the parameter being unnamed as naming
the parameter results in this code compiling successfully.


More information about the Gcc-bugs mailing list