https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121255
Bug ID: 121255
Summary: I got an internal compiler error while using the
coroutine
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: q1210081098 at gmail dot com
Target Milestone: ---
The code and results are as follows:
https://gcc.godbolt.org/z/3MTjsssPs
I have defined a generator
```
template<typename T>
struct Generator {
struct promise_type;
using handle_t = std::coroutine_handle<promise_type>;
... ...
private:
handle_t handle_;
};
```
And output numbers from 0 to 5
```
Generator<int> countdown(int start) {
for (int i = start; i >= 0; --i)
co_yield i;
co_return 0;
}
int main() {
for (auto it = countdown(5); it.next();) {
std::cout << it.current_value() << ' ';
}
return 0;
}
```
But there are some issues here with co_deturn 0
```
<source>:71:15: internal compiler error: in build_new_method_call, at
cp/call.cc:11963
71 | co_return 0;
| ^
0x2888a55 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x287e306 internal_error(char const*, ...)
???:0
0xaf5508 fancy_abort(char const*, int, char const*)
???:0
0xb8cf60 finish_co_return_stmt(unsigned long, tree_node*)
???:0
0xd23093 c_parse_file()
???:0
0xe8dc89 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```