[cfe-dev] Clang error message implicitly-deleted copy constructor

Nico Weber thakis at chromium.org
Tue Mar 27 09:05:17 PDT 2012


Which standard library is your pair<> from? If a class has an explicit
move assignment operator, this will implicitly mark the default copy
constructor as deleted, and the class author has to provide an
explicit copy constructor (likely with move semantics) if copying
should work. Maybe your c++ standard library gets this wrong. (The one
that ships with MSVC2010 does get this wrong for example.)

Nico

On Tue, Mar 27, 2012 at 8:57 AM, Fletcher, John P
<j.p.fletcher at aston.ac.uk> wrote:
> Apologies that this not related to clang development, more to clang usage.
>
> I have this error message:
>
> error: call to implicitly-deleted copy constructor of
>      'std::pair<int, int>'
>
> This is happening when I use a templated list and attempt to make a list of std::pair<int,int>.
>
> This used to work fine but now fails with clang 3.1 with C++11.
>
> Please could someone point me to somewhere where there is discussion on this.  I would like to adapt my code to (a) detect a std::pair and (b) take appropriate action.  I have made some progress with (a) but complete frustration with (b).
>
> It does not look a clever idea to try and put a copy constructor into std::pair.
>
> There are more details at http://c2.com/cgi/wiki?ImplicitlyDeletedCopyConstructor
>
> Thanks
>
> John
>
> Dr John P. Fletcher Tel: (44) 121 204 3389 (direct line), FAX: (44) 121 204 3678
> Chemical Engineering and Applied Chemistry (CEAC),
> formerly Associate Dean - External Relations,
> School of Engineering and Applied Science (EAS),
> Aston University, Aston Triangle, BIRMINGHAM B4 7ET  U.K.
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list