Suppress GCC 8 warning about realloc() non-trivially-copyable types

But they are movable.

qxmlstream_p.h:654:32: error: ‘void* realloc(void*, size_t)’ moving an object of non-trivially copyable type ‘struct QXmlStreamPrivateTagStack::Tag’; use ‘new’ and ‘delete’ instead [-Werror=class-memaccess]

Change-Id: I41d006aac5bc48529845fffd150e8115eb852034
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Thiago Macieira 2018-01-29 22:00:46 -08:00
parent c26c5b7d0d
commit 403343039d

View File

@ -651,7 +651,8 @@ public:
inline void reserve(int extraCapacity) {
if (tos + extraCapacity + 1 > cap) {
cap = qMax(tos + extraCapacity + 1, cap << 1 );
data = reinterpret_cast<T *>(realloc(data, cap * sizeof(T)));
void *ptr = realloc(static_cast<void *>(data), cap * sizeof(T));
data = reinterpret_cast<T *>(ptr);
Q_CHECK_PTR(data);
}
}