https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118324
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Type deduction for class |Type deduction for class
|with deleted copy |with deleted or private
|constructor failed in |copy constructor failed in
|lambda parameter |lambda parameter
Keywords|rejects-valid |diagnostic
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
MSVC rejects it though:
```
<source>(6): error C2280: 'A::A(const A &)': attempting to reference a deleted
function
<source>(3): note: see declaration of 'A::A'
<source>(3): note: 'A::A(const A &)': function was explicitly deleted
<source>(6): note: the template instantiation context (the oldest one first) is
<source>(6): note: while compiling class template member function
'<lambda_dd0c676f9dbc7de61b44269a473dda25>::operator unknown-type (__cdecl
*)(_T1)(__cdecl *(void) noexcept const)(_T1)'
<source>(6): note: see reference to alias template instantiation
'<lambda_dd0c676f9dbc7de61b44269a473dda25>::<lambda_typedef_cdecl><A>' being
compiled
<source>(6): note: see reference to function template instantiation 'void
<lambda_dd0c676f9dbc7de61b44269a473dda25>::<lambda_invoker_cdecl><_T>(_T)'
being compiled
with
[
_T=A
]
<source>(6): error C2440: 'initializing': cannot convert from
'<lambda_dd0c676f9dbc7de61b44269a473dda25>' to 'void (__cdecl *)(A)'
<source>(6): note: No user-defined-conversion operator available that can
perform this conversion, or the operator cannot be called
```
Basically what is happening is a creating of a thunk that will do a copy
constructor. Both GCC and MSVC reject it due to that creation of a thunk would
be invalid because it requires a copy constructor.