Clang error message implicitly-deleted copy constructor

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.

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

Nico

That could be the problem. I am using the std library which comes with gcc 4.4 (as patched for clang as per the web pages) as I am running Ubuntu 10.4. Should I try a different version of libstdc++?

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.

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).

I'm not entirely sure what you're getting at - where are you doing (a)?

In any case, this is probably the same bug in libstdc++ that was
discussed on the list 6 months ago. I believe it was fixed in
libstdc++ since then. The original cfe-dev thread is here:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-September/017183.html
and some better documentation (though it still doesn't call out the
libstdc++ issue) for Clang's conformance is here:
http://clang.llvm.org/compatibility.html#deleted-special-func

David

Thank you very much. I have followed through on the September 2011 case and it does look like a problem in libstdc++ not clang, fixed in later libstdc++ than the 4.4 I am using.

John

http://clang.llvm.org/cxx_status.html links to a patch for libstdc++
4.4 to make it work with clang.

Nico