int main(int argc, char* argv[]) { std::vector > foo; foo.push_back(std::auto_ptr(new int)); return 0; } test.cpp: In function `int main(int, char**)': test.cpp:9: error: no matching function for call to `std::auto_ptr::auto_ptr(std::auto_ptr)' /usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/memory:351: note: candidates are: std::auto_ptr<_Tp>::auto_ptr(std::auto_ptr_ref<_Tp>) [with _Tp = int] /usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/memory:213: note: std::auto_ptr<_Tp>::auto_ptr(std::auto_ptr<_Tp1>&) [with _Tp1 = int, _Tp = int] /usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/memory:200: note: std::auto_ptr<_Tp>::auto_ptr(std::auto_ptr<_Tp>&) [with _Tp = int] /usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_construct.h: In function `void std::_Construct(_T1*, const _T2&) [with _T1 = std::auto_ptr, _T2 = std::auto_ptr]': /usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_vector.h:560: instantiated from `void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = std::auto_ptr, _Alloc = std::allocator >]' test.cpp:9: instantiated from here /usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_construct.h:81: error: passing `const std::auto_ptr' as `this' argument of `std::auto_ptr<_Tp>::operator std::auto_ptr_ref<_Tp1>() [with _Tp1 = int, _Tp = int]' discards qualifiers /usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/bits/vector.tcc: In member function `void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx::__normal_iterator >, const _Tp&) [with _Tp = std::auto_ptr, _Alloc = std::allocator >]': /usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_vector.h:564: instantiated from `void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = std::auto_ptr, _Alloc = std::allocator >]' test.cpp:9: instantiated from here /usr/lib/gcc/i486-slackware-linux/3.4.6/../../../../include/c++/3.4.6/bits/vector.tcc:234: error: passing `const std::auto_ptr' as `this' argument of `std::auto_ptr<_Tp>::operator std::auto_ptr_ref<_Tp1>() [with _Tp1 = int, _Tp = int]' discards qualifiers