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

            Bug ID: 102883
           Summary: Calling co_yield with initializer list containing
                    shared_ptr causes internal compiler error
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brad.nemanich at amd dot com
  Target Milestone: ---

When calling co_yield on an intializer_list that contains a shared_ptr, gcc
10.3 is failing with `internal compiler error: in build_special_member_call, at
cp/call.c:9787`.

Below is a short example that causes the error.

```
#include <memory>
#include <coroutine>

template <std::movable T>
class Generator
{
public:
    struct promise_type
    {
        Generator<T> get_return_object();
        void return_void() noexcept { }
        void unhandled_exception() noexcept;
        static std::suspend_always initial_suspend() noexcept { return {}; }
        static std::suspend_always   final_suspend() noexcept { return {}; }
        std::suspend_always yield_value(T v) noexcept;
    };
};

struct MyStruct
{
    MyStruct(std::initializer_list<std::shared_ptr<int>> dst);
};


Generator<MyStruct> add(std::shared_ptr<int> dest)
{
    //MyStruct tmp({dest});
    //co_yield tmp;
    co_yield MyStruct({dest});
}
```

Reply via email to