diff --git a/src/qml/jsapi/qjsprimitivevalue.h b/src/qml/jsapi/qjsprimitivevalue.h index 3551eca358..5981bcf23a 100644 --- a/src/qml/jsapi/qjsprimitivevalue.h +++ b/src/qml/jsapi/qjsprimitivevalue.h @@ -932,10 +932,14 @@ private: } union { - bool m_bool = false; + bool m_bool; int m_int; double m_double; QString m_string; + + // Dummy value to trigger initialization of the whole storage. + // We don't want to see maybe-uninitialized warnings every time we access m_string. + std::byte m_zeroInitialize[sizeof(QString)] = {}; }; Type m_type = Undefined;