https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65279
Bug ID: 65279 Summary: [4.8/4.9/5 Regression] std::scoped_allocator_adaptor is not assignable Product: gcc Version: 5.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org #include <memory> #include <scoped_allocator> #include <vector> int main() { std::vector<int, std::scoped_allocator_adaptor<std::allocator<int>>> v, w; w = std::move(v); } This compiles OK (using -std=c++11) with 4.7 but not 4.8 or later: In file included from /home/jwakely/gcc/4.8.0/include/c++/4.8.0/ext/alloc_traits.h:36:0, from /home/jwakely/gcc/4.8.0/include/c++/4.8.0/bits/stl_construct.h:61, from /home/jwakely/gcc/4.8.0/include/c++/4.8.0/memory:64, from saa.cc:1: /home/jwakely/gcc/4.8.0/include/c++/4.8.0/bits/alloc_traits.h: In instantiation of ‘void std::__do_alloc_on_move(_Alloc&, _Alloc&, std::true_type) [with _Alloc = std::scoped_allocator_adaptor<std::allocator<int> >; std::true_type = std::integral_constant<bool, true>]’: /home/jwakely/gcc/4.8.0/include/c++/4.8.0/bits/alloc_traits.h:490:49: required from ‘void std::__alloc_on_move(_Alloc&, _Alloc&) [with _Alloc = std::scoped_allocator_adaptor<std::allocator<int> >]’ /home/jwakely/gcc/4.8.0/include/c++/4.8.0/bits/stl_vector.h:1364:36: required from ‘void std::vector<_Tp, _Alloc>::_M_move_assign(std::vector<_Tp, _Alloc>&&, std::true_type) [with _Tp = int; _Alloc = std::scoped_allocator_adaptor<std::allocator<int> >; std::true_type = std::integral_constant<bool, true>]’ /home/jwakely/gcc/4.8.0/include/c++/4.8.0/bits/stl_vector.h:445:65: required from ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::scoped_allocator_adaptor<std::allocator<int> >]’ saa.cc:8:5: required from here /home/jwakely/gcc/4.8.0/include/c++/4.8.0/bits/alloc_traits.h:479:13: error: use of deleted function ‘std::scoped_allocator_adaptor<std::allocator<int> >& std::scoped_allocator_adaptor<std::allocator<int> >::operator=(const std::scoped_allocator_adaptor<std::allocator<int> >&)’ { __one = std::move(__two); } ^ In file included from saa.cc:2:0: /home/jwakely/gcc/4.8.0/include/c++/4.8.0/scoped_allocator:176:11: note: ‘std::scoped_allocator_adaptor<std::allocator<int> >& std::scoped_allocator_adaptor<std::allocator<int> >::operator=(const std::scoped_allocator_adaptor<std::allocator<int> >&)’ is implicitly declared as deleted because ‘std::scoped_allocator_adaptor<std::allocator<int> >’ declares a move constructor or move assignment operator class scoped_allocator_adaptor ^