This program compiles in sequential mode but not in debug mode: --------------------- #include <algorithm> struct X { X(int); }; bool operator< (const X&, const X&);
void f () { X *p, *q; std::sort (p, q); } ------------------- The reason is that X does not have a default constructor. I don't think the standard prescribes that it should need one (as a matter of fact, the standard only talks in terms of iterators as arguments, not of the types they point to -- if they're pointers at all). However, the parallel mode requires a default constructor. For reference, here's the error message: 4.3.0/parallel/multiway_mergesort.h: In function 'void __gnu_parallel::parallel_sort_mwms(RandomAccessIterator, RandomAccessIterator, Comparator, typename std::iterator_traits<_Iterator>::difference_type, int, bool) [with RandomAccessIterator = X*, Comparator = std::less<X>]': 4.3.0/parallel/sort.h:88: instantiated from 'void __gnu_parallel::parallel_sort(RandomAccessIterator, RandomAccessIterator, Comparator, bool) [with RandomAccessIterator = X*, Comparator = std::less<X>]' 4.3.0/parallel/algo.h:1300: instantiated from 'void std::__parallel::sort(_RAIter, _RAIter, _Compare) [with _RAIter = X*, _Compare = std::less<X>]' 4.3.0/parallel/algo.h:1287: instantiated from 'void std::__parallel::sort(_RAIter, _RAIter) [with _RAIter = X*]' x.cc:7: instantiated from here 4.3.0/parallel/multiway_mergesort.h:369: error: no matching function for call to 'X::X()' x.cc:2: note: candidates are: X::X(int) x.cc:2: note: X::X(const X&) 4.3.0/parallel/multiseq_selection.h: In function 'void __gnu_parallel::multiseq_partition(RanSeqs, RanSeqs, RankType, RankIterator, Comparator) [with RanSeqs = __gnu_cxx::__normal_iterator<std::pair<X*, X*>*, std::__cxx1998::vector<std::pair<X*, X*>, std::allocator<std::pair<X*, X*> > > >, RankType = int, RankIterator = __gnu_cxx::__normal_iterator<X**, std::__cxx1998::vector<X*, std::allocator<X*> > >, Comparator = std::less<X>]': 4.3.0/parallel/multiway_mergesort.h:252: instantiated from 'void __gnu_parallel::parallel_sort_mwms_pu(__gnu_parallel::PMWMSSorterPU<RandomAccessIterator>*, Comparator&) [with RandomAccessIterator = X*, Comparator = std::less<X>]' 4.3.0/parallel/multiway_mergesort.h:394: instantiated from 'void __gnu_parallel::parallel_sort_mwms(RandomAccessIterator, RandomAccessIterator, Comparator, typename std::iterator_traits<_Iterator>::difference_type, int, bool) [with RandomAccessIterator = X*, Comparator = std::less<X>]' 4.3.0/parallel/sort.h:88: instantiated from 'void __gnu_parallel::parallel_sort(RandomAccessIterator, RandomAccessIterator, Comparator, bool) [with RandomAccessIterator = X*, Comparator = std::less<X>]' 4.3.0/parallel/algo.h:1300: instantiated from 'void std::__parallel::sort(_RAIter, _RAIter, _Compare) [with _RAIter = X*, _Compare = std::less<X>]' 4.3.0/parallel/algo.h:1287: instantiated from 'void std::__parallel::sort(_RAIter, _RAIter) [with _RAIter = X*]' x.cc:7: instantiated from here 4.3.0/parallel/multiseq_selection.h:305: error: no matching function for call to 'X::X()' x.cc:2: note: candidates are: X::X(int) x.cc:2: note: X::X(const X&) 4.3.0/parallel/multiseq_selection.h:305: error: no matching function for call to 'X::X()' x.cc:2: note: candidates are: X::X(int) x.cc:2: note: X::X(const X&) This sort of thing is repeated for several more pages. W. -- Summary: parallel v3: sort assumes that the type of the objects to be sorted have a default constructor Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bangerth at dealii dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33489