public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/33489]  New: parallel v3: sort assumes that the type of the objects to be sorted have a default constructor
@ 2007-09-19  2:47 bangerth at dealii dot org
  2007-09-19 17:07 ` [Bug libstdc++/33489] " bkoz at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2007-09-19  2:47 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2007-10-18 18:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-19  2:47 [Bug libstdc++/33489] New: parallel v3: sort assumes that the type of the objects to be sorted have a default constructor bangerth at dealii dot org
2007-09-19 17:07 ` [Bug libstdc++/33489] " bkoz at gcc dot gnu dot org
2007-09-21  3:24 ` bkoz at gcc dot gnu dot org
2007-09-26 17:27 ` bkoz at gcc dot gnu dot org
2007-09-26 19:42 ` bangerth at dealii dot org
2007-10-06 15:32 ` [Bug libstdc++/33489] parallel v3: not default constructable issues bkoz at gcc dot gnu dot org
2007-10-08 15:58 ` [Bug libstdc++/33489] parallel v3: not default constructible issues bkoz at gcc dot gnu dot org
2007-10-09 20:49 ` bkoz at gcc dot gnu dot org
2007-10-09 20:50 ` bkoz at gcc dot gnu dot org
2007-10-09 20:51 ` bangerth at dealii dot org
2007-10-09 21:40 ` bkoz at gcc dot gnu dot org
2007-10-18 16:06 ` bkoz at gcc dot gnu dot org
2007-10-18 18:46 ` bangerth at dealii dot 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).