C++ 使用clang编译无法使用libstdc++;4.4.7和-std=c++;0x

C++ 使用clang编译无法使用libstdc++;4.4.7和-std=c++;0x,c++,c++11,clang,libstdc++,C++,C++11,Clang,Libstdc++,我正在尝试使用clang在旧RHEL5机器上编译一些代码,该机器使用libstdc++4.4.7。当我启用-std=c++0x标志时,我得到: /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&

我正在尝试使用clang在旧RHEL5机器上编译一些代码,该机器使用
libstdc++4.4.7
。当我启用
-std=c++0x
标志时,我得到:

/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); }
/usr/lib/gcc/i386-redhat-linux6E/4.4.7/../../../../../../include/c++/4.4.7/bits/vector.tcc:380:19:错误:调用隐式删除的复制构造函数
“值类型”(也称为“标准::对”)
值\u类型\uuux\u副本=\uuuux;
^          ~~~
/usr/lib/gcc/i386-redhat-linux6E/4.4.7/../../../../../../../../include/c++/4.4.7/bits/stl_vector.h:851:9:注意:在成员函数的实例化中
此处请求“std::vector::_M_fill_insert”
{M_fill_insert(__位置,__n,__x)}

这是在我对应用了(修复了其他错误,但没有修复此错误)之后。当我禁用
-std=c++0x
时,它工作正常。听起来补丁可能没有修复所有的问题,这是一个已知的问题,并且有已知的修复方法吗

补丁不完整

Clang是正确的,代码是错误的:复制构造函数应该被删除,因为
std::pair
声明了一个移动构造函数,但这是因为Clang正在实现最终的C++11规则,并且GCC 4.4头被编写为与GCC 4.4支持的早期版本的C++0x草稿一起使用

您应该能够通过将其添加到
std::pair

pair(const pair&) = default;
pair& operator=(const pair&) = default;

这将恢复隐式定义的复制操作,因此Clang不会删除它们。

@Zoidberg,谢谢,修复了错误。所以,如果我错了,请纠正我,但这意味着使用Clang的
libstdc++4.4
的每个用户都有相同的问题。如果这些行修复了问题,那么维护Clang的人可以很容易地修改补丁。是的,我希望每个使用这种组合的人都会有同样的问题。我认为4.4标题中的
shared_ptr
也存在同样的问题,可能还有其他类