This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: GCC 3.1 Release



> > It's a library bug.  It can be fixed by adding explicit comparison
> > operators for the vector and string iterators.
> >
> > The downside of that is that it adds a bit of extra bloat.
> 
> If you can produce a patch for the problem, the I will review it --
> and I'm sure the V3 folks will be happy to do so as well.  It sounds
> like you're in the best position to produce the patch.

I'm going to give you a partial patch.  The reason is that I still
haven't won my battle with a company lawyer who doesn't like the FSF's
patent clause in the contribution document.  So instead I'll show you
how to fix the bug by giving one of the four new templates needed.
That way the size of my contribution will be smaller than the limit
RMS feels comfortable with for folks with no papers on file.

The issue is that, for std::rel_ops::operator!=, the types of the two
arguments are constrained to be the same, while in stl_iterator.h, we
define another operator!= template that allows the two arguments to be
different.  The solution is to add another template definition, as
follows:

*** /u/jbuck/gcc-3.1-pre/include/g++-v3/bits/stl_iterator.h~	Wed Apr 10
13:26:51 2002
--- /u/jbuck/gcc-3.1-pre/include/g++-v3/bits/stl_iterator.h	Wed Apr 10
16:43:56 2002
***************
*** 645,650 ****
--- 645,657 ----
	     const __normal_iterator<_IteratorR, _Container>& __rhs)
    { return !(__lhs == __rhs); }
  
+   // the following is to avoid conflict with std::rel_ops::operator!=
+   template<typename _Iterator, typename _Container>
+   inline bool
+   operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
+	     const __normal_iterator<_Iterator, _Container>& __rhs)
+   { return !(__lhs == __rhs); }
+ 
    // Random access iterator requirements
    template<typename _IteratorL, typename _IteratorR, typename
_Container>
    inline bool 

---------------------------------
This removes the ambiguity: in all cases where the new template can
be used, it wins over the one from rel_ops because it is more specific,
as well as the alternative template in stl_iterator.h.

In addition to the above, we also need the corresponding operator>,
operator>=, and operator<=.


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