public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/52591] New: [C++0x] [4.7 Regression] moving std::vector relies on movable elements
@ 2012-03-14 21:10 expipiplus1 at gmail dot com
  2012-03-14 22:58 ` [Bug libstdc++/52591] " paolo.carlini at oracle dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: expipiplus1 at gmail dot com @ 2012-03-14 21:10 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: expipiplus1@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<true, false,
std::random_access_iterator_tag>::__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<C*, std::vector<C> >; _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<C*, std::vector<C> > >; _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<C*, std::vector<C> > >; _Tp =
C; _Alloc = std::allocator<C>]'
/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<C*,
std::vector<C> > >; _Tp = C; _Alloc = std::allocator<C>]'
/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<C*, std::vector<C> > >; _Tp =
C; _Alloc = std::allocator<C>]'
/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<C>; std::vector<_Tp, _Alloc> = std::vector<C>]'
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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-04-11 21:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-14 21:10 [Bug libstdc++/52591] New: [C++0x] [4.7 Regression] moving std::vector relies on movable elements expipiplus1 at gmail dot com
2012-03-14 22:58 ` [Bug libstdc++/52591] " paolo.carlini at oracle dot com
2012-03-14 23:47 ` expipiplus1 at gmail dot com
2012-03-15  0:29 ` paolo.carlini at oracle dot com
2012-03-15  0:36 ` redi at gcc dot gnu.org
2012-03-15  0:51 ` redi at gcc dot gnu.org
2012-03-15  0:58 ` redi at gcc dot gnu.org
2012-03-15  1:02 ` redi at gcc dot gnu.org
2012-03-15  1:21 ` paolo.carlini at oracle dot com
2012-03-15  1:26 ` redi at gcc dot gnu.org
2012-03-15  4:14 ` redi at gcc dot gnu.org
2012-04-01 22:05 ` redi at gcc dot gnu.org
2012-04-01 22:12 ` redi at gcc dot gnu.org
2012-04-11 21:14 ` redi at gcc dot gnu.org
2012-04-11 21:15 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).