This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: serious bug in libstdc++-3.2 std::copy?
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: nbecker at hns dot com (Neal D. Becker)
- Cc: gcc at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: 04 Dec 2002 19:21:17 +0100
- Subject: Re: serious bug in libstdc++-3.2 std::copy?
- Organization: Integrable Solutions
- References: <x884r9tycmn.fsf@rpppc1.md.hns.com>
nbecker@hns.com (Neal D. Becker) writes:
[...]
| 3. inline _OutputIter
| __copy_ni2(_InputIter __first, _InputIter __last,
| _OutputIter __result, __true_type)
|
| OK, output is normal
|
| 4. template<typename _Tp>
| inline _Tp*
| __copy_aux2(_Tp* __first, _Tp* __last,
| _Tp* __result, __true_type)
|
| OK, type has trivial assign (in this case it is int)
|
| 5. template<typename _Tp>
| inline _Tp*
| __copy_trivial(const _Tp* __first, const _Tp* __last, _Tp*
| __result)
|
| Wrong! This calls memmove. But the input iterator doesn't have
| pointer-type semantics.
If step 4 is OK, then step 5 ought to be OK: the input iterator is of
pointer type.
As an aside, this is a case where I really do prefer class
template-based compile-time dispatcher over overloading.
-- Gaby