diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-01-29 21:46:40 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-02-04 08:33:59 +0000 |
commit | c26c5b7d0dc4607b7cdd5569c5180b94b4563b73 (patch) | |
tree | 5f370afc73566024e601b067bc774840339b7690 | |
parent | 1514b4e85336245ef130deca5839267dba7b2e32 (diff) |
Silence GCC 8 warning on memcpy of movable types
This is similar to commit 342bb5b03a76d1428fafb8e1532d66e172bd1c0b.
From GCC 8:
qarraydataops.h:84:17: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class QStringRef’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
[etc.]
Change-Id: I41d006aac5bc48529845fffd150e817e64973bec
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/tools/qarraydataops.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index b7c3bc1287..d0f83d2b6a 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -76,7 +76,8 @@ struct QPodArrayOps Q_ASSERT(b < e); Q_ASSERT(size_t(e - b) <= this->alloc - uint(this->size)); - ::memcpy(this->end(), b, (e - b) * sizeof(T)); + ::memcpy(static_cast<void *>(this->end()), static_cast<const void *>(b), + (e - b) * sizeof(T)); this->size += e - b; } diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index d99eebd4b9..58bb5e75c4 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -344,7 +344,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::append(const T *abuf, in while (s < asize) new (ptr+(s++)) T(*abuf++); } else { - memcpy(&ptr[s], abuf, increment * sizeof(T)); + memcpy(static_cast<void *>(&ptr[s]), static_cast<const void *>(abuf), increment * sizeof(T)); s = asize; } } @@ -392,7 +392,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a QT_RETHROW; } } else { - memcpy(ptr, oldPtr, copySize * sizeof(T)); + memcpy(static_cast<void *>(ptr), static_cast<const void *>(oldPtr), copySize * sizeof(T)); } } s = copySize; |