Remove use of templates in tst_qatomicinteger.

MSVC 2008 is confused by TypeInStruct being a template, resulting in

\tst_qatomicinteger.cpp(189) : error C2027: use of undefined type 'QStaticAssertFailure<Test>'
        with
        [
            Test=false
        ]

for int (and thus for all unsupported types). This appears to be a real
Heisenbug-nature compiler bug as it can also be fixed by adding
qDebug() << Q_ALIGNOF(TypeInStruct<T>)
before the static assert.

Task-number: QTBUG-37195

Change-Id: Ib2b60f3c1ffeb0b8bdeb1fb0c659655ce4ab10d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Friedemann Kleint 2014-03-03 11:57:20 +01:00 committed by The Qt Project
parent f0d411cfbb
commit b22ef59663
1 changed files with 2 additions and 2 deletions

View File

@ -181,12 +181,12 @@ private Q_SLOTS:
};
template <bool> inline void booleanHelper() { }
template <typename T> struct TypeInStruct { T type; };
struct TypeInStruct { TEST_TYPE type; };
void tst_QAtomicIntegerXX::static_checks()
{
Q_STATIC_ASSERT(sizeof(QAtomicInteger<T>) == sizeof(T));
Q_STATIC_ASSERT(Q_ALIGNOF(QAtomicInteger<T>) == Q_ALIGNOF(TypeInStruct<T>));
Q_STATIC_ASSERT(Q_ALIGNOF(QAtomicInteger<T>) == Q_ALIGNOF(TypeInStruct));
// statements with no effect
(void) QAtomicInteger<T>::isReferenceCountingNative();