QOperatingSystemVersion: fix UB (invalid static_cast)
When the QOSVBase we're constructing from isn't an actual
QOSVUnexported, the cast from QOSVBase to QOSVUnexported is
invalid. Instead of casting, add an QOSVUnexported(QOSVBase) ctor and
just call that.
Amends 2156778184.
Pick-to: 6.7 6.6
Change-Id: I7352a044b62086585f1b036433f9b8779c77ac9d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
bb10
parent
1b89d747d7
commit
e3c831dc55
|
|
@ -111,6 +111,8 @@ class QOperatingSystemVersionUnexported : public QOperatingSystemVersionBase
|
|||
{
|
||||
public:
|
||||
using QOperatingSystemVersionBase::QOperatingSystemVersionBase;
|
||||
constexpr QOperatingSystemVersionUnexported(QOperatingSystemVersionBase other) noexcept
|
||||
: QOperatingSystemVersionBase(other) {}
|
||||
#else
|
||||
class QOperatingSystemVersion : public QOperatingSystemVersionBase
|
||||
{
|
||||
|
|
@ -226,7 +228,7 @@ public:
|
|||
static constexpr QOperatingSystemVersionBase MacOSVentura { QOperatingSystemVersionBase::MacOS, 13, 0 };
|
||||
|
||||
constexpr QOperatingSystemVersion(const QOperatingSystemVersionBase &osversion)
|
||||
: QOperatingSystemVersionUnexported(static_cast<const QOperatingSystemVersionUnexported &>(osversion)) {}
|
||||
: QOperatingSystemVersionUnexported(osversion) {}
|
||||
|
||||
constexpr QOperatingSystemVersion(OSType osType, int vmajor, int vminor = -1, int vmicro = -1)
|
||||
: QOperatingSystemVersionUnexported(QOperatingSystemVersionBase::OSType(osType), vmajor, vminor,
|
||||
|
|
|
|||
Loading…
Reference in New Issue