https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123338
Bug ID: 123338
Summary: ICE: Segmentation fault in cp_coroutine_transform with
non-class promise_type(eg. int)
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: 522024330006 at smail dot nju.edu.cn
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/Y7KfEzsnM
The code crashed only on gcc trunk.
```c
#include <coroutine>
template<>
struct std::coroutine_traits<int, int> {
using promise_type = int;
};
int coro(int x) {
co_return 42;
}
```
Part of the traceback:
```console
internal compiler error: Segmentation fault
0x290fae8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x29048ab internal_error(char const*, ...)
???:0
0xbb430d cp_coroutine_transform::build_ramp_function()
???:0
0xbb5aba cp_coroutine_transform::apply_transforms()
???:0
0xc10461 finish_function(bool)
???:0
0xd52ed3 c_parse_file()
???:0
0xec4909 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
```