Here is a test program: // Call uninitialized_fill on a type with a default copy constructor // but no default assignment operator.
#include <memory> #include <utility> typedef std::pair<const int, int> MyPair; void Alpha(MyPair* start, MyPair* end) { MyPair my_pair(1, 2); std::uninitialized_fill(start, end, my_pair); }; === This program compiles with gcc 4.2.0 and does not compile with gcc 4.3-20070525. [EMAIL PROTECTED]:~/exp-43-redux$ /home/mec/gcc-4.2.0/install/bin/g++ -Wall -S uninitialized-fill.cc [EMAIL PROTECTED]:~/exp-43-redux$ /home/mec/gcc-4.3-20070525/install/bin/g++ -Wall -S uninitialized-fill.cc /home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_pair.h: In member function 'std::pair<const int, int>& std::pair<const int, int>::operator=(const std::pair<const int, int>&)': /home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_pair.h:69: instantiated from 'static void std::__fill<<anonymous> >::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = MyPair*, _Tp = std::pair<const int, int>, bool <anonymous> = false]' /home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h:557: instantiated from 'void std::__fill_aux(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = MyPair*, _Tp = std::pair<const int, int>]' /home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h:595: instantiated from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = MyPair*, _Tp = std::pair<const int, int>]' /home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_uninitialized.h:146: instantiated from 'void std::uninitialized_fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = MyPair*, _Tp = MyPair]' uninitialized-fill.cc:14: instantiated from here /home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_pair.h:69: error: non-static const member 'const int std::pair<const int, int>::first', can't use default assignment operator /home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h: In static member function 'static void std::__fill<<anonymous> >::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = MyPair*, _Tp = std::pair<const int, int>, bool <anonymous> = false]': /home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h:533: note: synthesized method 'std::pair<const int, int>& std::pair<const int, int>::operator=(const std::pair<const int, int>&)' first required here [EMAIL PROTECTED]:~/exp-43-redux$ === This patch looks relevant: http://gcc.gnu.org/ml/libstdc++/2007-04/msg00016.html === I believe this program should compile, because std::uninitialized_fill is defined to call placement new several times. std::pair<const int, int> has a suitable copy constructor, but no assignment operator. -- Summary: uninitialized_fill compile failure if no default assignment operator Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mec at google dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32158