@@ -509,15 +509,15 @@ class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
509509 // / starting with "Dest", constructing elements into it as needed.
510510 template <typename T1, typename T2>
511511 static void uninitialized_copy (
512- T1 *I, T1 *E, T2 *Dest,
513- std::enable_if_t <std::is_same<std::remove_const_t <T1>, T2>::value> * =
514- nullptr ) {
512+ const T1 *I, const T1 *E, T2 *Dest,
513+ std::enable_if_t <std::is_same<T1, T2>::value> * = nullptr ) {
515514 // Use memcpy for PODs iterated by pointers (which includes SmallVector
516515 // iterators): std::uninitialized_copy optimizes to memmove, but we can
517516 // use memcpy here. Note that I and E are iterators and thus might be
518517 // invalid for memcpy if they are equal.
519518 if (I != E)
520- memcpy (reinterpret_cast <void *>(Dest), I, (E - I) * sizeof (T));
519+ memcpy (reinterpret_cast <void *>(Dest), reinterpret_cast <const void *>(I),
520+ (E - I) * sizeof (T));
521521 }
522522
523523 // / Double the size of the allocated memory, guaranteeing space for at
@@ -560,7 +560,8 @@ class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
560560public:
561561 void push_back (ValueParamT Elt) {
562562 const T *EltPtr = reserveForParamAndGetAddress (Elt);
563- memcpy (reinterpret_cast <void *>(this ->end ()), EltPtr, sizeof (T));
563+ memcpy (reinterpret_cast <void *>(this ->end ()),
564+ reinterpret_cast <const void *>(EltPtr), sizeof (T));
564565 this ->set_size (this ->size () + 1 );
565566 }
566567
0 commit comments