fork download
  1. #include <vector>
  2.  
  3. struct MoveOnlyType {
  4. MoveOnlyType() {}
  5. MoveOnlyType(const MoveOnlyType&) = delete;
  6. MoveOnlyType(MoveOnlyType&&) = default;
  7. MoveOnlyType& operator=(const MoveOnlyType&) = delete;
  8. MoveOnlyType& operator=(MoveOnlyType&&) = default;
  9. };
  10.  
  11. template class std::vector<MoveOnlyType>;
  12.  
  13. int main() {
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 3408KB
stdin
Standard input is empty
compilation info
In file included from /usr/include/c++/5/vector:69:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/vector.tcc: In instantiation of 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, const value_type&) [with _Tp = MoveOnlyType; _Alloc = std::allocator<MoveOnlyType>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<MoveOnlyType*, std::vector<MoveOnlyType> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = MoveOnlyType*; std::vector<_Tp, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const MoveOnlyType*, std::vector<MoveOnlyType> >; typename __gnu_cxx::__alloc_traits<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_pointer = const MoveOnlyType*; std::vector<_Tp, _Alloc>::value_type = MoveOnlyType]':
prog.cpp:11:21:   required from here
/usr/include/c++/5/bits/vector.tcc:127:23: error: use of deleted function 'MoveOnlyType::MoveOnlyType(const MoveOnlyType&)'
        _Tp __x_copy = __x;
                       ^
prog.cpp:5:2: note: declared here
  MoveOnlyType(const MoveOnlyType&) = delete;
  ^
In file included from /usr/include/c++/5/vector:69:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/vector.tcc: In instantiation of 'void std::vector<_Tp, _Alloc>::_M_fill_insert(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = MoveOnlyType; _Alloc = std::allocator<MoveOnlyType>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<MoveOnlyType*, std::vector<MoveOnlyType> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = MoveOnlyType*; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::value_type = MoveOnlyType]':
prog.cpp:11:21:   required from here
/usr/include/c++/5/bits/vector.tcc:457:30: error: use of deleted function 'MoveOnlyType::MoveOnlyType(const MoveOnlyType&)'
        value_type __x_copy = __x;
                              ^
prog.cpp:5:2: note: declared here
  MoveOnlyType(const MoveOnlyType&) = delete;
  ^
In file included from /usr/include/c++/5/vector:60:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<(! std::__is_scalar<_Tp>::__value), void>::__type std::__fill_a(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = MoveOnlyType*; _Tp = MoveOnlyType; typename __gnu_cxx::__enable_if<(! std::__is_scalar<_Tp>::__value), void>::__type = void]':
/usr/include/c++/5/bits/stl_algobase.h:743:20:   required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<MoveOnlyType*, std::vector<MoveOnlyType> >; _Tp = MoveOnlyType]'
/usr/include/c++/5/bits/vector.tcc:235:13:   required from 'void std::vector<_Tp, _Alloc>::_M_fill_assign(std::size_t, const value_type&) [with _Tp = MoveOnlyType; _Alloc = std::allocator<MoveOnlyType>; std::size_t = unsigned int; std::vector<_Tp, _Alloc>::value_type = MoveOnlyType]'
prog.cpp:11:21:   required from here
/usr/include/c++/5/bits/stl_algobase.h:697:11: error: use of deleted function 'MoveOnlyType& MoveOnlyType::operator=(const MoveOnlyType&)'
  *__first = __value;
           ^
prog.cpp:7:16: note: declared here
  MoveOnlyType& operator=(const MoveOnlyType&) = delete;
                ^
In file included from /usr/include/c++/5/vector:60:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<(! std::__is_scalar<_Tp>::__value), _OutputIterator>::__type std::__fill_n_a(_OutputIterator, _Size, const _Tp&) [with _OutputIterator = MoveOnlyType*; _Size = unsigned int; _Tp = MoveOnlyType; typename __gnu_cxx::__enable_if<(! std::__is_scalar<_Tp>::__value), _OutputIterator>::__type = MoveOnlyType*]':
/usr/include/c++/5/bits/stl_algobase.h:801:33:   required from '_OI std::fill_n(_OI, _Size, const _Tp&) [with _OI = MoveOnlyType*; _Size = unsigned int; _Tp = MoveOnlyType]'
/usr/include/c++/5/bits/vector.tcc:242:36:   required from 'void std::vector<_Tp, _Alloc>::_M_fill_assign(std::size_t, const value_type&) [with _Tp = MoveOnlyType; _Alloc = std::allocator<MoveOnlyType>; std::size_t = unsigned int; std::vector<_Tp, _Alloc>::value_type = MoveOnlyType]'
prog.cpp:11:21:   required from here
/usr/include/c++/5/bits/stl_algobase.h:754:11: error: use of deleted function 'MoveOnlyType& MoveOnlyType::operator=(const MoveOnlyType&)'
  *__first = __value;
           ^
prog.cpp:7:16: note: declared here
  MoveOnlyType& operator=(const MoveOnlyType&) = delete;
                ^
In file included from /usr/include/i386-linux-gnu/c++/5/bits/c++allocator.h:33:0,
                 from /usr/include/c++/5/bits/allocator.h:46,
                 from /usr/include/c++/5/vector:61,
                 from prog.cpp:1:
/usr/include/c++/5/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = MoveOnlyType; _Args = {const MoveOnlyType&}; _Tp = MoveOnlyType]':
/usr/include/c++/5/bits/alloc_traits.h:256:4:   required from 'static std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = MoveOnlyType; _Args = {const MoveOnlyType&}; _Alloc = std::allocator<MoveOnlyType>; std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> = void]'
/usr/include/c++/5/bits/alloc_traits.h:402:16:   required from 'static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = MoveOnlyType; _Args = {const MoveOnlyType&}; _Alloc = std::allocator<MoveOnlyType>; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]'
/usr/include/c++/5/bits/stl_vector.h:917:30:   required from 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = MoveOnlyType; _Alloc = std::allocator<MoveOnlyType>; std::vector<_Tp, _Alloc>::value_type = MoveOnlyType]'
prog.cpp:11:21:   required from here
/usr/include/c++/5/ext/new_allocator.h:120:4: error: use of deleted function 'MoveOnlyType::MoveOnlyType(const MoveOnlyType&)'
  { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
    ^
prog.cpp:5:2: note: declared here
  MoveOnlyType(const MoveOnlyType&) = delete;
  ^
In file included from /usr/include/c++/5/vector:62:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_construct.h: In instantiation of 'void std::_Construct(_T1*, _Args&& ...) [with _T1 = MoveOnlyType; _Args = {const MoveOnlyType&}]':
/usr/include/c++/5/bits/stl_uninitialized.h:75:18:   required from 'static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const MoveOnlyType*, std::vector<MoveOnlyType> >; _ForwardIterator = MoveOnlyType*; bool _TrivialValueTypes = false]'
/usr/include/c++/5/bits/stl_uninitialized.h:126:15:   required from '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const MoveOnlyType*, std::vector<MoveOnlyType> >; _ForwardIterator = MoveOnlyType*]'
/usr/include/c++/5/bits/stl_uninitialized.h:281:37:   required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const MoveOnlyType*, std::vector<MoveOnlyType> >; _ForwardIterator = MoveOnlyType*; _Tp = MoveOnlyType]'
/usr/include/c++/5/bits/stl_vector.h:322:31:   required from 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = MoveOnlyType; _Alloc = std::allocator<MoveOnlyType>]'
prog.cpp:11:21:   required from here
/usr/include/c++/5/bits/stl_construct.h:75:7: error: use of deleted function 'MoveOnlyType::MoveOnlyType(const MoveOnlyType&)'
     { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
       ^
prog.cpp:5:2: note: declared here
  MoveOnlyType(const MoveOnlyType&) = delete;
  ^
In file included from /usr/include/c++/5/vector:60:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h: In instantiation of 'static _OI std::__copy_move<false, false, std::random_access_iterator_tag>::__copy_m(_II, _II, _OI) [with _II = const MoveOnlyType*; _OI = MoveOnlyType*]':
/usr/include/c++/5/bits/stl_algobase.h:400:44:   required from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = const MoveOnlyType*; _OI = MoveOnlyType*]'
/usr/include/c++/5/bits/stl_algobase.h:436:45:   required from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = __gnu_cxx::__normal_iterator<const MoveOnlyType*, std::vector<MoveOnlyType> >; _OI = __gnu_cxx::__normal_iterator<MoveOnlyType*, std::vector<MoveOnlyType> >]'
/usr/include/c++/5/bits/stl_algobase.h:469:8:   required from '_OI std::copy(_II, _II, _OI) [with _II = __gnu_cxx::__normal_iterator<const MoveOnlyType*, std::vector<MoveOnlyType> >; _OI = __gnu_cxx::__normal_iterator<MoveOnlyType*, std::vector<MoveOnlyType> >]'
/usr/include/c++/5/bits/vector.tcc:206:31:   required from 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = MoveOnlyType; _Alloc = std::allocator<MoveOnlyType>]'
prog.cpp:11:21:   required from here
/usr/include/c++/5/bits/stl_algobase.h:340:18: error: use of deleted function 'MoveOnlyType& MoveOnlyType::operator=(const MoveOnlyType&)'
        *__result = *__first;
                  ^
prog.cpp:7:16: note: declared here
  MoveOnlyType& operator=(const MoveOnlyType&) = delete;
                ^
In file included from /usr/include/c++/5/vector:60:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h: In instantiation of 'static _OI std::__copy_move<false, false, std::random_access_iterator_tag>::__copy_m(_II, _II, _OI) [with _II = MoveOnlyType*; _OI = MoveOnlyType*]':
/usr/include/c++/5/bits/stl_algobase.h:400:44:   required from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = MoveOnlyType*; _OI = MoveOnlyType*]'
/usr/include/c++/5/bits/stl_algobase.h:436:45:   required from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = MoveOnlyType*; _OI = MoveOnlyType*]'
/usr/include/c++/5/bits/stl_algobase.h:469:8:   required from '_OI std::copy(_II, _II, _OI) [with _II = MoveOnlyType*; _OI = MoveOnlyType*]'
/usr/include/c++/5/bits/vector.tcc:211:17:   required from 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = MoveOnlyType; _Alloc = std::allocator<MoveOnlyType>]'
prog.cpp:11:21:   required from here
/usr/include/c++/5/bits/stl_algobase.h:340:18: error: use of deleted function 'MoveOnlyType& MoveOnlyType::operator=(const MoveOnlyType&)'
        *__result = *__first;
                  ^
prog.cpp:7:16: note: declared here
  MoveOnlyType& operator=(const MoveOnlyType&) = delete;
                ^
In file included from /usr/include/c++/5/vector:62:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_construct.h: In instantiation of 'void std::_Construct(_T1*, _Args&& ...) [with _T1 = MoveOnlyType; _Args = {MoveOnlyType&}]':
/usr/include/c++/5/bits/stl_uninitialized.h:75:18:   required from 'static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = MoveOnlyType*; _ForwardIterator = MoveOnlyType*; bool _TrivialValueTypes = false]'
/usr/include/c++/5/bits/stl_uninitialized.h:126:15:   required from '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = MoveOnlyType*; _ForwardIterator = MoveOnlyType*]'
/usr/include/c++/5/bits/stl_uninitialized.h:281:37:   required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = MoveOnlyType*; _ForwardIterator = MoveOnlyType*; _Tp = MoveOnlyType]'
/usr/include/c++/5/bits/vector.tcc:213:35:   required from 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = MoveOnlyType; _Alloc = std::allocator<MoveOnlyType>]'
prog.cpp:11:21:   required from here
/usr/include/c++/5/bits/stl_construct.h:75:7: error: use of deleted function 'MoveOnlyType::MoveOnlyType(const MoveOnlyType&)'
     { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
       ^
prog.cpp:5:2: note: declared here
  MoveOnlyType(const MoveOnlyType&) = delete;
  ^
stdout
Standard output is empty