From 342bb5b03a76d1428fafb8e1532d66e172bd1c0b Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Fri, 12 Jan 2018 16:29:00 +0200 Subject: Do a static_cast in bit-blasts that are UB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this, building Qt and Qt applications fails with GCC 8. The errors look like this: writing to an object of type ‘class QPointer’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] Task-number: QTBUG-65691 Change-Id: Ie5a30814125deca7a160b9a61f5aa3f944ee1ac9 Reviewed-by: Qt CI Bot Reviewed-by: Thiago Macieira --- src/gui/painting/qtransform.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui/painting/qtransform.h') diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 06ae611861..efb0fd7e83 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -78,14 +78,14 @@ public: #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove; the compiler-generated ones are fine! QTransform &operator=(QTransform &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(QTransform)); return *this; } + { memcpy(static_cast(this), static_cast(&other), sizeof(QTransform)); return *this; } QTransform &operator=(const QTransform &) Q_DECL_NOTHROW; // = default QTransform(QTransform &&other) Q_DECL_NOTHROW // = default : affine(Qt::Uninitialized) - { memcpy(this, &other, sizeof(QTransform)); } + { memcpy(static_cast(this), static_cast(&other), sizeof(QTransform)); } QTransform(const QTransform &other) Q_DECL_NOTHROW // = default : affine(Qt::Uninitialized) - { memcpy(this, &other, sizeof(QTransform)); } + { memcpy(static_cast(this), static_cast(&other), sizeof(QTransform)); } #endif bool isAffine() const; -- cgit v1.2.3