This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: serious bug in libstdc++-3.2 std::copy?


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


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