https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114142
Bug ID: 114142
Summary: [coroutines]: internal compiler error: tree check:
expected record_type or union_type or qual_union_type,
have reference_type in lookup_base, at
cp/search.cc:252
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ldalessandro at gmail dot com
Target Milestone: ---
```
#include <coroutine>
struct Bar {};
struct Task
{
struct promise_type
{
promise_type(Bar&) {}
std::suspend_never initial_suspend() { return {}; }
std::suspend_never final_suspend() noexcept { return {}; }
void return_void() {}
void unhandled_exception() {}
Task get_return_object() { return {}; }
};
};
struct Foo : Bar {
Task foo() {
co_await std::suspend_always();
co_return;
}
};
int main()
{
Foo x;
x.foo();
}
```
When I try and return a Task from a Derived member function and set the
promise's first parameter to the Base& I see this ICE.
In 13.2 this is a rejects-valid.
Current live example https://godbolt.org/z/9EceW8boz.