@@ -509,15 +509,15 @@ class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
509
509
// / starting with "Dest", constructing elements into it as needed.
510
510
template <typename T1, typename T2>
511
511
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 ) {
515
514
// Use memcpy for PODs iterated by pointers (which includes SmallVector
516
515
// iterators): std::uninitialized_copy optimizes to memmove, but we can
517
516
// use memcpy here. Note that I and E are iterators and thus might be
518
517
// invalid for memcpy if they are equal.
519
518
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));
521
521
}
522
522
523
523
// / Double the size of the allocated memory, guaranteeing space for at
@@ -560,7 +560,8 @@ class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
560
560
public:
561
561
void push_back (ValueParamT Elt) {
562
562
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));
564
565
this ->set_size (this ->size () + 1 );
565
566
}
566
567
0 commit comments