Bug (typo?) in stl_deque.h

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Fri Dec 31 20:54:00 GMT 1999


> In stl/stl_deque.h, line 345 (CVS, date 19991205) reads:

Thanks for your bug report, here is a patch.

Ok to install?

1999-12-07  Martin v. Löwis  <loewis@informatik.hu-berlin.de>

	* stl_deque.h (_Deque_base::const_iterator): Change third
	template argument to pointer type.
	Reported by Carlo Wood <carlo@node1500a.a2000.nl>

// Build don't run:
#include <deque>

struct S{
  int k;
};

typedef deque<S> ideque;

int main()
{
  ideque d;
  int sum = 0;
  for(ideque::const_iterator i = d.begin(); i<d.end(); i++)
    sum += i->k;
}

Index: stl_deque.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++/stl/stl_deque.h,v
retrieving revision 1.4
diff -u -r1.4 stl_deque.h
--- stl_deque.h	1999/11/22 23:35:50	1.4
+++ stl_deque.h	1999/12/07 08:51:47
@@ -342,7 +342,7 @@
           _Base;
   typedef typename _Base::allocator_type allocator_type;
   typedef _Deque_iterator<_Tp,_Tp&,_Tp*,__bufsiz>              iterator;
-  typedef _Deque_iterator<_Tp,const _Tp&,const _Tp&, __bufsiz> const_iterator;
+  typedef _Deque_iterator<_Tp,const _Tp&,const _Tp*, __bufsiz> const_iterator;
 
   _Deque_base(const allocator_type& __a, size_t __num_elements)
     : _Base(__a), _M_start(), _M_finish()



More information about the Gcc-bugs mailing list