The parallel version of std::accumulate assumes that iterator_traits are declared for the iterator arguments. However, the standard only requires them to be of kind InputIterator, and the table that describes what types of this kind have to satisfy does not include the necessity to declare a specialization of std::iterator_traits.
Example in point: this doesn't compile with current parallel v3: -------------------- #include <numeric> struct X { int operator* () const; bool operator != (const X&) const; X operator ++ (); }; void f () { X p, q; std::accumulate (p, q, 0); } --------------------- 4.3.0/bits/stl_iterator_base_types.h: In instantiation of 'std::iterator_traits<X>': 4.3.0/parallel/numeric:83: instantiated from 'T std::__parallel::accumulate(_IIter, _IIter, T, __gnu_parallel::parallelism) [with _IIter = X, T = int]' x.cc:11: instantiated from here 4.3.0/bits/stl_iterator_base_types.h:133: error: no type named 'iterator_category' in 'struct X' 4.3.0/bits/stl_iterator_base_types.h:134: error: no type named 'value_type' in 'struct X' 4.3.0/bits/stl_iterator_base_types.h:135: error: no type named 'difference_type' in 'struct X' 4.3.0/bits/stl_iterator_base_types.h:136: error: no type named 'pointer' in 'struct X' 4.3.0/bits/stl_iterator_base_types.h:137: error: no type named 'reference' in 'struct X' -- Summary: parallel v3: std::accumulate assumes iterators have std::iterator_traits declared 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=33490