http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52591
Bug #: 52591
Summary: [C++0x] [4.7 Regression] moving std::vector relies on
movable elements
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: libstdc++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: expipipl...@gmail.com
Created attachment 26894
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26894
A simple testcase.
libstdc++ has a code branch in the move assignment operator of vector which
depends on the move assignment operator of the element type.
I'm compiling with 'g++ -std=c++11 test.cpp'
The attached code compiles with no problems using either:
'g++-4.6 -std=c++0x test.cpp' or
'clang++ -std=c++11 -stdlib=libc++ test.cpp'
The wonderful template error message:
In file included from
/usr/local/lib/gcc/x86_64-linux-gnu/4.7.0/../../../../include/c++/4.7.0/vector:61:0,
from move.cpp:1:
/usr/local/lib/gcc/x86_64-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:
In instantiation of 'static _OI std::__copy_move::__copy_m(_II, _II, _OI) [with _II = C*; _OI =
C*]':
/usr/local/lib/gcc/x86_64-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:384:70:
required from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove =
true; _II = C*; _OI = C*]'
/usr/local/lib/gcc/x86_64-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:422:39:
required from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove =
true; _II = __gnu_cxx::__normal_iterator >; _OI = C*]'
/usr/local/lib/gcc/x86_64-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:454:18:
required from '_OI std::copy(_II, _II, _OI) [with _II =
std::move_iterator<__gnu_cxx::__normal_iterator > >; _OI =
C*]'
/usr/local/lib/gcc/x86_64-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/vector.tcc:275:4:
required from 'void std::vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIterator,
_ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator =
std::move_iterator<__gnu_cxx::__normal_iterator > >; _Tp =
C; _Alloc = std::allocator]'
/usr/local/lib/gcc/x86_64-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_vector.h:1235:4:
required from 'void std::vector<_Tp,
_Alloc>::_M_assign_dispatch(_InputIterator, _InputIterator, std::__false_type)
[with _InputIterator = std::move_iterator<__gnu_cxx::__normal_iterator > >; _Tp = C; _Alloc = std::allocator]'
/usr/local/lib/gcc/x86_64-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_vector.h:506:4:
required from 'void std::vector<_Tp, _Alloc>::assign(_InputIterator,
_InputIterator) [with _InputIterator =
std::move_iterator<__gnu_cxx::__normal_iterator > >; _Tp =
C; _Alloc = std::allocator]'
/usr/local/lib/gcc/x86_64-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_vector.h:448:6:
required from 'std::vector<_Tp, _Alloc>& std::vector<_Tp,
_Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = C; _Alloc =
std::allocator; std::vector<_Tp, _Alloc> = std::vector]'
move.cpp:17:38: required from here
/usr/local/lib/gcc/x86_64-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:348:8:
error: use of deleted function 'C& C::operator=(const C&)'
move.cpp:4:7: note: 'C& C::operator=(const C&)' is implicitly deleted because
the default definition would be ill-formed:
move.cpp:4:7: error: non-static reference member 'int& C::m_r', can't use
default assignment operator