On domingo, 30 de setembro de 2012 18.50.49, Olivier Goffart wrote: > > In file included from /Qt/5.0/qtbase/include/QtCore/qvector.h:1: > > /Qt/5.0/qtbase/include/QtCore/../../src/corelib/tools/qvector.h:459:56: > > warning: source of this 'memcpy' call is a pointer to dynamic class > > 'QImage'; vtable pointer will be copied [-Wdynamic-class-memaccess] > > > > > > ::memcpy(static_cast<void *>(dst), srcBegin, > > > > > > (srcEnd - srcBegin) * sizeof(T)); > > > > ~~~~~~~~ ^ > > > > > > It seems that Qt thinks QImage is a POD type? > > Because QImage is registered as Q_MOVABLE_TYPE. > (It is the case since Q_DECLARE_SHARED does that) > > It shuld be safe in that case, because virtual table pointer should be > movable, and we know that we have arrays of QImage and not the derived type. > > But this warning may be annoying. Maybe should we work around it
We have. commit 60829b4a5692ebdd68b12830d7c722ccd31921ad Author: Kent Hansen <[email protected]> Date: Tue Jun 19 10:46:05 2012 +0200 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*) We followed clang's recommendation to static_cast to void*. Clang can't complain that we're doing exactly what it suggested we do. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center Intel Sweden AB - Registration Number: 556189-6027 Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
