diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-01-15 14:58:06 +0100 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-01-16 03:12:54 +0100 |
commit | 49057a1eab3d226d504db0e12e65e27fa9b42c2d (patch) | |
tree | 74c6f0d5b3099c5b72f399e5d77a66d3df16e8f3 /src/corelib/kernel/qvariant_p.h | |
parent | 47f99cacc42488a87eb6f3ea969cf9238a1d896f (diff) |
QVariant: attempt to work around an ICE on linux-arm-gnueabi-g++ (Ubuntu 11.10) with constexpr QSizePolicy
This is the error:
src/corelib/kernel/qvariant_p.h: In constructor ‘QVariantPrivateSharedEx<T>::QVariantPrivateSharedEx() [with T = QSizePolicy]’:
src/corelib/kernel/qvariant_p.h:107:61: internal compiler error: in gimplify_init_ctor_eval, at gimplify.c:3560
There are two things fishy in this file:
1. Use of the unnamed namespace in a file that gets included
in different libraries. While not technically undefined
behavior, it may become so when used in the implementation,
which it is.
2. Missing explicit initialization of a member of
QVariantPrivateSharedEx. This is just a wild guess, because
the ICE happens in that line. That class itself is quite
smelly, because the address of an object is taken before
the lifetime of the object begins. A fix would be to store
the object in a wrapper class from which QVPSEx inherits
_first_, but then a cast from QVPSEx to QVariant::PrivateShared
would require pointer adjustments, and I didn't look through
all the code to determine whether that would be an issue.
Having been bitten by this sometime ago:
https://marcmutz.wordpress.com/private-practice/private-practice-taming-templates/#edit-20111128
I opted to do these easy changes first to see whether they
already fix the ICE.
Change-Id: Ic15fd928b3dff2318c425c915b2dab5e54254d71
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qvariant_p.h')
-rw-r--r-- | src/corelib/kernel/qvariant_p.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index 9b9e266f8e..9e4f468872 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -54,7 +54,6 @@ QT_BEGIN_NAMESPACE -namespace { template<typename T> struct QVariantIntegrator { @@ -64,7 +63,6 @@ struct QVariantIntegrator Q_STATIC_ASSERT(QVariantIntegrator<double>::CanUseInternalSpace); Q_STATIC_ASSERT(QVariantIntegrator<long int>::CanUseInternalSpace); Q_STATIC_ASSERT(QVariantIntegrator<qulonglong>::CanUseInternalSpace); -} // namespace #ifdef Q_CC_SUN // Sun CC picks the wrong overload, so introduce awful hack @@ -104,7 +102,7 @@ inline T *v_cast(QVariant::Private *d, T * = 0) template <class T> class QVariantPrivateSharedEx : public QVariant::PrivateShared { public: - QVariantPrivateSharedEx() : QVariant::PrivateShared(&m_t) { } + QVariantPrivateSharedEx() : QVariant::PrivateShared(&m_t), m_t() { } QVariantPrivateSharedEx(const T&t) : QVariant::PrivateShared(&m_t), m_t(t) { } private: |