Reputation: 8370
I'm trying to use clang to compile some code on an old RHEL5 machine, which uses libstdc++4.4.7
. When I enable the -std=c++0x
flag, I get:
/usr/lib/gcc/i386-redhat-linux6E/4.4.7/../../../../include/c++/4.4.7/bits/vector.tcc:380:19: error: call to implicitly-deleted copy constructor of
'value_type' (aka 'std::pair<double, double>')
value_type __x_copy = __x;
^ ~~~
/usr/lib/gcc/i386-redhat-linux6E/4.4.7/../../../../include/c++/4.4.7/bits/stl_vector.h:851:9: note: in instantiation of member function
'std::vector<std::pair<double, double>, std::allocator<std::pair<double, double> > >::_M_fill_insert' requested here
{ _M_fill_insert(__position, __n, __x); }
This is after I applied the patch (which fixed other errors but not this one) on the clang site. When I disable -std=c++0x
it works fine. It sounds like the patch may not have fixed all the problems, is this a known issue, and is there a known fix?
Upvotes: 2
Views: 918
Reputation: 171283
The patch is incomplete.
Clang is correct that the code is wrong: The copy constructor should be deleted because std::pair
declares a move constructor, but that's because clang is implementing the final C++11 rules and the GCC 4.4 headers are written to work with an earlier version of the C++0x draft, as supported by GCC 4.4
You should be able to fix it by adding this to std::pair
:
pair(const pair&) = default;
pair& operator=(const pair&) = default;
That restores the implicitly-defined copy operations, so Clang won't delete them.
Upvotes: 2