Implicitly Deleted Copy Constructor

ImplicitlyDeletedCopyConstructor is a phrase I had not seen before today, when the Clang compiler (CeeLanguageFamilyFrontEnd) started to emit it when I asked it to compile code which I regarded as working.

-- JohnFletcher


I get error messages like this for some code in FC++(FunctoidsInCpp) which works up until now:

 fcpp/list.h:79:14: error: call to implicitly-deleted copy constructor of
      'std::pair<int, int>'
      return rep->cache().first(); 
             ^~~~~~~~~~~~~~~~~~~~
 fcpp/list.h:158:28: note: in instantiation of member function
      'fcpp::impl::List<std::pair<int, int> >::priv_head' requested here
   T head() const { return priv_head(); }
                           ^
 fcpp/list.h:576:16: note: in instantiation of member function
      'fcpp::impl::List<std::pair<int, int> >::head' requested here
      return l.head();
               ^
 fcpp/full.h:429:13: note: in instantiation of function template specialization
      'fcpp::impl::XHead::operator()<std::pair<int, int> >' requested here
     return f(x);
            ^
 fcppideas9.cpp:1116:25: note: in instantiation of function template
      specialization
      'fcpp::Full1<fcpp::impl::XHead>::operator()<fcpp::impl::List<std::pair<int,

/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/bits/stl_pair.h:67:12: note: 'pair<int, int>' defined here struct pair

The point of all this is that my code wants to make a copy of a std::pair<int,int> which used to work but now it does not. Here is a reference which explains why this has found its way into the new standard for CeePlusPlus (CeePlusPlusEleven). I have not found out how to set up the copy when the template argument passed into my code could be a std::pair or something else.

I am studying the FAQ (see CeePlusPlusEleven) to see how to change my code to resolve this. The consensus seems to be that this is a problem in libstdc++ for gcc 4.4. Later versions fix this. Interesting.

Now I am experimenting with libc++, which is a version of libstdc++ which comes with Clang. After the work of installing libc++ and then updating my version of the BoostLibraries, I have got there. See CeeLanguageFamilyFrontEnd. -- JohnFletcher


CategoryCpp


EditText of this page (last edited September 27, 2014) or FindPage with title or text search