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

            Bug ID: 116633
           Summary: [coroutines] ICE: Promise with Variadic Templated
                    Constructor and Reference to the Instance of the
                    Member Coroutine
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ivor+gccbugzilla at posteo dot ee
  Target Milestone: ---

When the coroutine promise's variadic template constructor's first argument is
a refence to the instance of the member coroutine, GCC 14.2 reports ICE. It
worked previously on 14.1. The relevant part is shown below, the full example
with both compilers is on https://godbolt.org/z/e9KPjzo47

When lines marked with Note 1 are changed to Note 1a, it works. Similarly if
access to the instance variable is omitted at Note 2.

struct [[nodiscard]] C {
        struct P {
                template <typename... TArgs>                    // Note 1
                P(A& instance, TArgs&&... args) { }             // Note 1
//              P(A& instance) { }                                             
// Note 1a
        }
}

struct A {
        std::string m_a { };
        C setA(std::string a) {
                m_a = a;                // Note 2
                co_return;
        }
};

Reply via email to