Silence clang warning in QVector::reallocData()
authorKent Hansen <kent.hansen@nokia.com>
Tue, 19 Jun 2012 08:46:05 +0000 (10:46 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 2 Jul 2012 23:55:42 +0000 (01:55 +0200)
commit60829b4a5692ebdd68b12830d7c722ccd31921ad
tree60c3ae39c86d9e4dafd2c9713dfe3dd3d6610dce
parentdeb8d178fe06e3f626f0e7152ac69504094a52a0
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>
src/corelib/tools/qvector.h