This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/2405: "using std::rel_ops" blows up std::vector



>Number:         2405
>Category:       c++
>Synopsis:       "using std::rel_ops" blows up std::vector
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 27 14:36:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Joe Buck
>Release:        3.0 20010327 (prerelease)
>Organization:
>Environment:
System: SunOS racerx 5.5.1 Generic_103640-34 sun4u sparc SUNW,Ultra-Enterprise
Architecture: sun4

	
host: sparc-sun-solaris2.5.1
build: sparc-sun-solaris2.5.1
target: sparc-sun-solaris2.5.1
configured with: ../gcc/configure --prefix=/u/jbuck/gcc-cvs --disable-nls
>Description:

Not sure whether this is a library bug or a g++ bug, or both.
The effect is that trying to use the relational operator templates
from std::rel_ops blows up the vector class.

Compiling the example below results in

PREFIX/include/g++-v3/bits/concept_checks.h: In static member 
   function `static _Type 
   _STL_ERROR::__equality_comparable_requirement_violation(_Type, _Type) [with 
   _Type = std::__normal_iterator<int*, std::vector<int, std::allocator<int> > 
   >]':
PREFIX/include/g++-v3/bits/concept_checks.h:552:   instantiated from `static void _EqualityComparable_concept_specification<_Type>::_EqualityComparable_requirement_violation(_Type) [with _Type = std::__normal_iterator<int*, std::vector<int, std::allocator<int> > >]'
PREFIX/include/g++-v3/bits/concept_checks.h:580:   instantiated from `static void _TrivialIterator_concept_specification<_TrivialIterator>::_TrivialIterator_requirement_violation(_TrivialIterator) [with _TrivialIterator = std::__normal_iterator<int*, std::vector<int, std::allocator<int> > >]'
PREFIX/include/g++-v3/bits/concept_checks.h:605:   instantiated from `static void _InputIterator_concept_specification<_InputIterator>::_InputIterator_requirement_violation(_InputIterator) [with _InputIterator = std::__normal_iterator<int*, std::vector<int, std::allocator<int> > >]'
PREFIX/include/g++-v3/bits/concept_checks.h:645:   instantiated from `static void _ForwardIterator_concept_specification<_ForwardIterator>::_ForwardIterator_requirement_violation(_ForwardIterator) [with _ForwardIterator = std::__normal_iterator<int*, std::vector<int, std::allocator<int> > >]'
PREFIX/include/g++-v3/bits/concept_checks.h:669:   instantiated from `static void _BidirectionalIterator_concept_specification<_BidirectionalIterator>::_BidirectionalIterator_requirement_violation(_BidirectionalIterator) [with _BidirectionalIterator = std::__normal_iterator<int*, std::vector<int, std::allocator<int> > >]'
PREFIX/include/g++-v3/bits/stl_algobase.h:437:   instantiated from `_BI2 std::copy_backward(_BI1, _BI1, _BI2) [with _BI1 = std::__normal_iterator<int*, std::vector<int, std::allocator<int> > >, _BI2 = std::__normal_iterator<int*, std::vector<int, std::allocator<int> > >]'
PREFIX/include/g++-v3/bits/stl_vector.h:644:   instantiated from `void std::vector<_Tp, _Alloc>::_M_insert_aux(std::__normal_iterator<_Tp*, std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = int, _Alloc = std::allocator<int>]'
PREFIX/include/g++-v3/bits/stl_vector.h:348:   instantiated from `void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = int, _Alloc = std::allocator<int>]'
foo.cxx:5:   instantiated from here
PREFIX/include/g++-v3/bits/concept_checks.h:402: ambiguous overload 
   for `std::__normal_iterator<int*, std::vector<int, std::allocator<int> > >& 
   != std::__normal_iterator<int*, std::vector<int, std::allocator<int> > >&' 
   operator
PREFIX/include/g++-v3/bits/stl_relops.h:47: candidates are: bool 
   std::rel_ops::operator!=(const _Tp&, const _Tp&) [with _Tp = 
   std::__normal_iterator<int*, std::vector<int, std::allocator<int> > >]
PREFIX/include/g++-v3/bits/stl_iterator.h:1046:                 bool 
   std::operator!=(const std::__normal_iterator<_IteratorL, _Container>&, const 
   std::__normal_iterator<_IteratorR, _Container>&) [with _IteratorL = int*, 
   _IteratorR = int*, _Container = std::vector<int, std::allocator<int> >]

>How-To-Repeat:
	Here is the example, in file foo.cxx above.

------------------------------------------------
#include <utility>
using std::rel_ops::operator!=;
#include <vector>
using std::vector;
void add_to(vector<int>& v, int x) { v.push_back(x);}
------------------------------------------------



>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]