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>
bb10
parent
47f99cacc4
commit
49057a1eab
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue