public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: [STL] stl_construct.h: wrong comparison
       [not found] <36A64C0A.6B0B95D7.cygnus.egcs.bugs@menuett.rhein-main.de>
@ 1999-01-20 18:14 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 1999-01-20 18:14 UTC (permalink / raw)
  To: egcs-bugs

jmaurer@menuett.rhein-main.de (Jens Maurer) writes:

> Note that this function requires forward iterators (only), but
> erroneously uses "first < last", which is only valid for
> random access iterators.

You are right.  I've fixed this now.  Thanks,

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------


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

* [STL] stl_construct.h: wrong comparison
@ 1999-01-20 13:35 Jens Maurer
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Maurer @ 1999-01-20 13:35 UTC (permalink / raw)
  To: egcs-bugs

Regarding the STL implementation of egcs-1.1.1 release,
there seems to be a bug in stl_construct.h in the following
code:

template <class ForwardIterator>
inline void
__destroy_aux(ForwardIterator first, ForwardIterator last, __false_type)
{
  for ( ; first < last; ++first)
    destroy(&*first);
}

Note that this function requires forward iterators (only), but
erroneously uses "first < last", which is only valid for
random access iterators.

The code should read

...
   for ( ; first != last; ++first) 
...


Other occurrences of the text "first < last" seem to be correct,
as they deal with random access iterators:

> grep "first < last" /usr/local/include/g++/*

Jens Maurer.



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

end of thread, other threads:[~1999-01-20 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <36A64C0A.6B0B95D7.cygnus.egcs.bugs@menuett.rhein-main.de>
1999-01-20 18:14 ` [STL] stl_construct.h: wrong comparison Ulrich Drepper
1999-01-20 13:35 Jens Maurer

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).