summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-06-19 10:46:05 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-03 01:55:42 +0200
commit60829b4a5692ebdd68b12830d7c722ccd31921ad (patch)
tree60c3ae39c86d9e4dafd2c9713dfe3dd3d6610dce /src/corelib/tools
parentdeb8d178fe06e3f626f0e7152ac69504094a52a0 (diff)
Silence clang warning in QVector::reallocData()
qvector.h:459:30: warning: destination for this 'memcpy' call is a pointer to dynamic class 'QImage'; vtable pointer will be overwritten [-Wdynamic-class-memaccess] ::memcpy(dst, srcBegin, (srcEnd - srcBegin) * sizeof(T)); ~~~~~~~~ ^ qvector.h:459:30: note: explicitly cast the pointer to silence this warning ::memcpy(dst, srcBegin, (srcEnd - srcBegin) * sizeof(T)); ^ (void*) QImage inherits from QPaintDevice, which has virtual functions. qimage.h declares QImage as a movable type, so QTypeInfo<QImage>::isStatic is false. Hence, the memcpy codepath will be reached when the vector is not shared. We should trust that people declaring such type traits know what they're doing, so silence the warning. Change-Id: If36582f57a398fc237fb4bd4f72938fb09667118 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qvector.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index b75c2975b6..f3ef9b97c3 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -456,7 +456,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
new (dst++) T(*srcBegin++);
}
} else {
- ::memcpy(dst, srcBegin, (srcEnd - srcBegin) * sizeof(T));
+ ::memcpy(static_cast<void *>(dst), srcBegin, (srcEnd - srcBegin) * sizeof(T));
dst += srcEnd - srcBegin;
// destruct unused / not moved data