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

            Bug ID: 103358
           Summary: what is the first constructor argument of lambda
                    coroutine promise_type?
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: netcan1996 at gmail dot com
  Target Milestone: ---

the C++20 standard(N4858) says:
> promise-constructor-arguments is determined as follows: overload resolution 
> is performed on a promise
constructor call created by assembling an argument list with lvalues p1 . . .
pn. If a viable constructor is
found (12.4.3), then promise-constructor-arguments is (p1 , . . . , pn),
otherwise promise-constructor-
arguments is empty.

I tested gcc-12 coroutine feature, when I use the free coroutine function,
arguments are that function, but when I use lambda coroutine, the first
argument looks strange, the rest arguments are the same as lambda.

```cpp
auto test = [](int, char, double) -> task<void> {
    co_return;
};

```

the promise_type dumps all arguments type:
```cpp
        template<typename ...T>
        promise_type(T&&... args) {
            dump<T...> {};
        }
```

T = {const<lambda(int, char, double)>&&, int&, char&, double&} here, what is
the type `const<lambda(int, char, double)>&&`?

Reply via email to