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

            Bug ID: 106695
           Summary: Regression 11,12: Explicit copy constructor does not
                    work for a parameter passed via std::async
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This program:
```
#include <future>

struct A {
    A() = default;
    explicit A(const A &) = default;
};

void foo(const A &) {}

int main() {
    auto f = std::async(std::launch::async, foo, A{});
}
```
is accepted in GCC 10, MSVC and Clang with libc++, but not in GCC 11/12:

error: could not convert '{std::forward<void (&)(const A&)>((* & __args#0)),
std::forward<A>((* & __args#1))}' from '<brace-enclosed initializer list>' to
'std::tuple<void (*)(const A&), A>'
 1693 |           _M_fn{{std::forward<_Args>(__args)...}}

Online demo: https://gcc.godbolt.org/z/nMn33PTbd

Related discussion: https://stackoverflow.com/q/73417828/7325599

Reply via email to