summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-06-11 11:35:19 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-06-19 19:38:23 +0200
commit3e1d03b1eaf6a5e842bed4ae4f9bb8cca05e5b31 (patch)
tree74dd3478dce3bc96121238300fc0bbc6ef97fc3e /tests/auto
parent5b686e208ffc68f9f660d36c468280d50a40e3ad (diff)
Port Q_STATIC_ASSERT(_X) to static_assert
There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/global/qflags/tst_qflags.cpp16
-rw-r--r--tests/auto/corelib/global/qglobal/qglobal.c6
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp26
-rw-r--r--tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp4
-rw-r--r--tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp8
-rw-r--r--tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp14
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp20
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp14
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp2
-rw-r--r--tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp2
-rw-r--r--tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp2
-rw-r--r--tests/auto/corelib/text/qstringview/tst_qstringview.cpp164
-rw-r--r--tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp4
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp2
-rw-r--r--tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp2
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp4
-rw-r--r--tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp2
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp2
-rw-r--r--tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp4
-rw-r--r--tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp12
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp2
-rw-r--r--tests/auto/corelib/tools/qpair/tst_qpair.cpp38
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp4
-rw-r--r--tests/auto/corelib/tools/qvector/tst_qvector.cpp12
-rw-r--r--tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp8
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp2
-rw-r--r--tests/auto/other/toolsupport/tst_toolsupport.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp8
28 files changed, 195 insertions, 191 deletions
diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp
index 4df448373d..7060fc8b31 100644
--- a/tests/auto/corelib/global/qflags/tst_qflags.cpp
+++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp
@@ -135,10 +135,10 @@ void tst_QFlags::signedness()
// underlying type is implementation-defined, we need to allow for
// a different signedness, so we only check that the relative
// signedness of the types matches:
- Q_STATIC_ASSERT((std::is_unsigned<typename std::underlying_type<Qt::MouseButton>::type>::value ==
+ static_assert((std::is_unsigned<typename std::underlying_type<Qt::MouseButton>::type>::value ==
std::is_unsigned<Qt::MouseButtons::Int>::value));
- Q_STATIC_ASSERT((std::is_signed<typename std::underlying_type<Qt::AlignmentFlag>::type>::value ==
+ static_assert((std::is_signed<typename std::underlying_type<Qt::AlignmentFlag>::type>::value ==
std::is_signed<Qt::Alignment::Int>::value));
}
@@ -149,9 +149,9 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( MyStrictFlags )
enum class MyStrictNoOpEnum { StrictZero, StrictOne, StrictTwo, StrictFour=4 };
Q_DECLARE_FLAGS( MyStrictNoOpFlags, MyStrictNoOpEnum )
-Q_STATIC_ASSERT( !QTypeInfo<MyStrictFlags>::isComplex );
-Q_STATIC_ASSERT( !QTypeInfo<MyStrictFlags>::isStatic );
-Q_STATIC_ASSERT( !QTypeInfo<MyStrictFlags>::isPointer );
+static_assert( !QTypeInfo<MyStrictFlags>::isComplex );
+static_assert( !QTypeInfo<MyStrictFlags>::isStatic );
+static_assert( !QTypeInfo<MyStrictFlags>::isPointer );
void tst_QFlags::classEnum()
{
@@ -319,9 +319,9 @@ enum MyEnum { Zero, One, Two, Four=4 };
Q_DECLARE_FLAGS( MyFlags, MyEnum )
Q_DECLARE_OPERATORS_FOR_FLAGS( MyFlags )
-Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isComplex );
-Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isStatic );
-Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isPointer );
+static_assert( !QTypeInfo<MyFlags>::isComplex );
+static_assert( !QTypeInfo<MyFlags>::isStatic );
+static_assert( !QTypeInfo<MyFlags>::isPointer );
QTEST_MAIN(tst_QFlags)
#include "tst_qflags.moc"
diff --git a/tests/auto/corelib/global/qglobal/qglobal.c b/tests/auto/corelib/global/qglobal/qglobal.c
index 7a2266ae94..2f59119292 100644
--- a/tests/auto/corelib/global/qglobal/qglobal.c
+++ b/tests/auto/corelib/global/qglobal/qglobal.c
@@ -106,6 +106,12 @@ Q_STATIC_ASSERT(!0);
Q_STATIC_ASSERT(!!true);
Q_STATIC_ASSERT(!!1);
+#ifdef __COUNTER__
+// if the compiler supports __COUNTER__, multiple
+// Q_STATIC_ASSERT's on a single line should compile:
+Q_STATIC_ASSERT(true); Q_STATIC_ASSERT_X(!false, "");
+#endif // __COUNTER__
+
#ifdef Q_COMPILER_THREAD_LOCAL
static thread_local int gt_var;
void thread_local_test()
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index cde4ea9633..7787c00218 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -345,6 +345,9 @@ struct MyTemplate
void tst_QGlobal::qstaticassert()
{
+ // Test multiple Q_STATIC_ASSERT on a single line
+ Q_STATIC_ASSERT(true); Q_STATIC_ASSERT_X(!false, "");
+
// Force compilation of these classes
MyTrue tmp1;
MyExpresion tmp2;
@@ -352,11 +355,6 @@ void tst_QGlobal::qstaticassert()
Q_UNUSED(tmp1);
Q_UNUSED(tmp2);
Q_UNUSED(tmp3);
-#ifdef __COUNTER__
- // if the compiler supports __COUNTER__, multiple
- // Q_STATIC_ASSERT's on a single line should compile:
- Q_STATIC_ASSERT(true); Q_STATIC_ASSERT_X(!false, "");
-#endif // __COUNTER__
QVERIFY(true); // if the test compiles it has passed.
}
@@ -433,15 +431,15 @@ typedef int (Empty::*memFun) ();
void tst_QGlobal::integerForSize()
{
// compile-only test:
- Q_STATIC_ASSERT(sizeof(QIntegerForSize<1>::Signed) == 1);
- Q_STATIC_ASSERT(sizeof(QIntegerForSize<2>::Signed) == 2);
- Q_STATIC_ASSERT(sizeof(QIntegerForSize<4>::Signed) == 4);
- Q_STATIC_ASSERT(sizeof(QIntegerForSize<8>::Signed) == 8);
-
- Q_STATIC_ASSERT(sizeof(QIntegerForSize<1>::Unsigned) == 1);
- Q_STATIC_ASSERT(sizeof(QIntegerForSize<2>::Unsigned) == 2);
- Q_STATIC_ASSERT(sizeof(QIntegerForSize<4>::Unsigned) == 4);
- Q_STATIC_ASSERT(sizeof(QIntegerForSize<8>::Unsigned) == 8);
+ static_assert(sizeof(QIntegerForSize<1>::Signed) == 1);
+ static_assert(sizeof(QIntegerForSize<2>::Signed) == 2);
+ static_assert(sizeof(QIntegerForSize<4>::Signed) == 4);
+ static_assert(sizeof(QIntegerForSize<8>::Signed) == 8);
+
+ static_assert(sizeof(QIntegerForSize<1>::Unsigned) == 1);
+ static_assert(sizeof(QIntegerForSize<2>::Unsigned) == 2);
+ static_assert(sizeof(QIntegerForSize<4>::Unsigned) == 4);
+ static_assert(sizeof(QIntegerForSize<8>::Unsigned) == 8);
}
typedef QPair<const char *, const char *> stringpair;
diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
index e1b8336955..da52e6e026 100644
--- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
+++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
@@ -228,7 +228,7 @@ void tst_QNumeric::distinctNaNF() {
template<typename F, typename Whole>
void tst_QNumeric::generalNaN_data()
{
- Q_STATIC_ASSERT(sizeof(F) == sizeof(Whole));
+ static_assert(sizeof(F) == sizeof(Whole));
QTest::addColumn<Whole>("whole");
// Every value with every bit of the exponent set is a NaN.
// Sign and mantissa can be anything without interfering with that.
@@ -251,7 +251,7 @@ void tst_QNumeric::generalNaN_data()
template<typename F, typename Whole>
void tst_QNumeric::generalNaN()
{
- Q_STATIC_ASSERT(sizeof(F) == sizeof(Whole));
+ static_assert(sizeof(F) == sizeof(Whole));
QFETCH(const Whole, whole);
F nan;
memcpy(&nan, &whole, sizeof(F));
diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
index c3407bcc52..1c6e013adb 100644
--- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
+++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
@@ -182,8 +182,8 @@ void tst_QRandomGenerator::basics()
QRandomGenerator64 systemRng64 = *system64;
systemRng64 = *system64;
- Q_STATIC_ASSERT(std::is_same<decltype(rng64.generate()) COMMA quint64>::value);
- Q_STATIC_ASSERT(std::is_same<decltype(system64->generate()) COMMA quint64>::value);
+ static_assert(std::is_same<decltype(rng64.generate()) COMMA quint64>::value);
+ static_assert(std::is_same<decltype(system64->generate()) COMMA quint64>::value);
}
void tst_QRandomGenerator::knownSequence()
@@ -390,7 +390,7 @@ void tst_QRandomGenerator::quality()
AcceptableThreshold = 4 * PerfectDistribution,
FailureThreshold = 16 * PerfectDistribution
};
- Q_STATIC_ASSERT(FailureThreshold > AcceptableThreshold);
+ static_assert(FailureThreshold > AcceptableThreshold);
QFETCH(uint, control);
if (control & RandomDataMask)
@@ -609,7 +609,7 @@ void tst_QRandomGenerator::boundedQuality()
AcceptableThreshold = 4 * PerfectDistribution,
FailureThreshold = 16 * PerfectDistribution
};
- Q_STATIC_ASSERT(FailureThreshold > AcceptableThreshold);
+ static_assert(FailureThreshold > AcceptableThreshold);
QFETCH(uint, control);
if (control & RandomDataMask)
diff --git a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp
index 6ed0a6caa9..6452800bf0 100644
--- a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp
+++ b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp
@@ -109,13 +109,13 @@ void tst_QMetaEnum::defaultConstructed()
QCOMPARE(e.name(), QByteArray());
}
-Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper<tst_QMetaEnum::SuperEnum>::Value);
-Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper<Qt::WindowFlags>::Value);
-Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper<Qt::Orientation>::Value);
-Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<int>::Value);
-Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<QObject>::Value);
-Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<QObject*>::Value);
-Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<void>::Value);
+static_assert(QtPrivate::IsQEnumHelper<tst_QMetaEnum::SuperEnum>::Value);
+static_assert(QtPrivate::IsQEnumHelper<Qt::WindowFlags>::Value);
+static_assert(QtPrivate::IsQEnumHelper<Qt::Orientation>::Value);
+static_assert(!QtPrivate::IsQEnumHelper<int>::Value);
+static_assert(!QtPrivate::IsQEnumHelper<QObject>::Value);
+static_assert(!QtPrivate::IsQEnumHelper<QObject*>::Value);
+static_assert(!QtPrivate::IsQEnumHelper<void>::Value);
QTEST_MAIN(tst_QMetaEnum)
#include "tst_qmetaenum.moc"
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 2688d90b43..651efa53cf 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -677,21 +677,21 @@ void tst_QMetaType::type_fromSubString()
namespace {
template <typename T>
struct static_assert_trigger {
- Q_STATIC_ASSERT(( QMetaTypeId2<T>::IsBuiltIn ));
+ static_assert(( QMetaTypeId2<T>::IsBuiltIn ));
enum { value = true };
};
}
#define CHECK_BUILTIN(MetaTypeName, MetaTypeId, RealType) static_assert_trigger< RealType >::value &&
-Q_STATIC_ASSERT(( FOR_EACH_CORE_METATYPE(CHECK_BUILTIN) true ));
+static_assert(( FOR_EACH_CORE_METATYPE(CHECK_BUILTIN) true ));
#undef CHECK_BUILTIN
-Q_STATIC_ASSERT(( QMetaTypeId2<QList<QVariant> >::IsBuiltIn));
-Q_STATIC_ASSERT(( QMetaTypeId2<QMap<QString,QVariant> >::IsBuiltIn));
-Q_STATIC_ASSERT(( QMetaTypeId2<QObject*>::IsBuiltIn));
-Q_STATIC_ASSERT((!QMetaTypeId2<tst_QMetaType*>::IsBuiltIn)); // QObject subclass
-Q_STATIC_ASSERT((!QMetaTypeId2<QList<int> >::IsBuiltIn));
-Q_STATIC_ASSERT((!QMetaTypeId2<QMap<int,int> >::IsBuiltIn));
-Q_STATIC_ASSERT((!QMetaTypeId2<QMetaType::Type>::IsBuiltIn));
+static_assert(( QMetaTypeId2<QList<QVariant> >::IsBuiltIn));
+static_assert(( QMetaTypeId2<QMap<QString,QVariant> >::IsBuiltIn));
+static_assert(( QMetaTypeId2<QObject*>::IsBuiltIn));
+static_assert((!QMetaTypeId2<tst_QMetaType*>::IsBuiltIn)); // QObject subclass
+static_assert((!QMetaTypeId2<QList<int> >::IsBuiltIn));
+static_assert((!QMetaTypeId2<QMap<int,int> >::IsBuiltIn));
+static_assert((!QMetaTypeId2<QMetaType::Type>::IsBuiltIn));
void tst_QMetaType::create_data()
{
@@ -2090,7 +2090,7 @@ void tst_QMetaType::constRefs()
QCOMPARE(::qMetaTypeId<const CustomMovable &>(), ::qMetaTypeId<CustomMovable>());
QCOMPARE(::qMetaTypeId<const QList<CustomMovable> &>(), ::qMetaTypeId<QList<CustomMovable> >());
#if defined(Q_COMPILER_CONSTEXPR)
- Q_STATIC_ASSERT(::qMetaTypeId<const int &>() == ::qMetaTypeId<int>());
+ static_assert(::qMetaTypeId<const int &>() == ::qMetaTypeId<int>());
#endif
}
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index b2dc3c7297..7c806ed78d 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -6973,13 +6973,13 @@ void tst_QObject::checkArgumentsForNarrowing()
static constexpr bool IsUnscopedEnumSigned = std::is_signed_v<std::underlying_type_t<UnscopedEnum>>;
-#define NARROWS_IF(x, y, test) Q_STATIC_ASSERT((QtPrivate::AreArgumentsConvertibleWithoutNarrowingBase<x, y>::value) != (test))
-#define FITS_IF(x, y, test) Q_STATIC_ASSERT((QtPrivate::AreArgumentsConvertibleWithoutNarrowingBase<x, y>::value) == (test))
+#define NARROWS_IF(x, y, test) static_assert((QtPrivate::AreArgumentsConvertibleWithoutNarrowingBase<x, y>::value) != (test))
+#define FITS_IF(x, y, test) static_assert((QtPrivate::AreArgumentsConvertibleWithoutNarrowingBase<x, y>::value) == (test))
#define NARROWS(x, y) NARROWS_IF(x, y, true)
#define FITS(x, y) FITS_IF(x, y, true)
- Q_STATIC_ASSERT(sizeof(UnscopedEnum) <= sizeof(int));
- Q_STATIC_ASSERT(sizeof(SignedUnscopedEnum) <= sizeof(int));
+ static_assert(sizeof(UnscopedEnum) <= sizeof(int));
+ static_assert(sizeof(SignedUnscopedEnum) <= sizeof(int));
// floating point to integral
@@ -7230,7 +7230,7 @@ void tst_QObject::checkArgumentsForNarrowing()
NARROWS_IF(UnscopedEnum, long long, sizeof(UnscopedEnum) > sizeof(long long) || (sizeof(UnscopedEnum) == sizeof(long long) && !IsUnscopedEnumSigned));
NARROWS_IF(UnscopedEnum, unsigned long long, IsUnscopedEnumSigned);
- Q_STATIC_ASSERT(std::is_signed<typename std::underlying_type<SignedUnscopedEnum>::type>::value);
+ static_assert(std::is_signed<typename std::underlying_type<SignedUnscopedEnum>::type>::value);
NARROWS_IF(SignedUnscopedEnum, signed char, (sizeof(SignedUnscopedEnum) > sizeof(char)));
NARROWS_IF(SignedUnscopedEnum, short, (sizeof(SignedUnscopedEnum) > sizeof(short)));
@@ -7469,8 +7469,8 @@ void tst_QObject::disconnectDisconnects()
}
// Test for QtPrivate::HasQ_OBJECT_Macro
-Q_STATIC_ASSERT(QtPrivate::HasQ_OBJECT_Macro<tst_QObject>::Value);
-Q_STATIC_ASSERT(!QtPrivate::HasQ_OBJECT_Macro<SiblingDeleter>::Value);
+static_assert(QtPrivate::HasQ_OBJECT_Macro<tst_QObject>::Value);
+static_assert(!QtPrivate::HasQ_OBJECT_Macro<SiblingDeleter>::Value);
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 0b760f75a8..fdd39cb0a4 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -3563,7 +3563,7 @@ struct BigConvertible {
};
Q_DECLARE_METATYPE(BigConvertible);
-Q_STATIC_ASSERT(sizeof(BigConvertible) > sizeof(QVariant));
+static_assert(sizeof(BigConvertible) > sizeof(QVariant));
void tst_QVariant::userConversion()
{
diff --git a/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp b/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp
index f969bb9074..e73b863989 100644
--- a/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp
+++ b/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp
@@ -363,7 +363,7 @@ template <typename T> static inline bool canConvertTo(double v)
// integrals to floating-point with loss of precision has implementation-
// defined behavior whether the next higher or next lower is returned;
// converting FP to integral is UB if it can't be represented.;
- Q_STATIC_ASSERT(std::numeric_limits<T>::is_integer);
+ static_assert(std::numeric_limits<T>::is_integer);
double supremum = ldexp(1, std::numeric_limits<T>::digits);
if (v >= supremum)
diff --git a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
index ebf1da0cc9..73d9f8e765 100644
--- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
@@ -2206,7 +2206,7 @@ void tst_QByteArray::movablity()
{
QFETCH(QByteArray, array);
- Q_STATIC_ASSERT(!QTypeInfo<QByteArray>::isStatic);
+ static_assert(!QTypeInfo<QByteArray>::isStatic);
const int size = array.size();
const bool isEmpty = array.isEmpty();
diff --git a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
index 0185837535..83bb372490 100644
--- a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
+++ b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp
@@ -50,9 +50,9 @@
template <typename T>
using CanConvert = std::is_convertible<T, QStringView>;
-Q_STATIC_ASSERT(!CanConvert<QLatin1String>::value);
-Q_STATIC_ASSERT(!CanConvert<const char*>::value);
-Q_STATIC_ASSERT(!CanConvert<QByteArray>::value);
+static_assert(!CanConvert<QLatin1String>::value);
+static_assert(!CanConvert<const char*>::value);
+static_assert(!CanConvert<QByteArray>::value);
// QStringView qchar_does_not_compile() { return QStringView(QChar('a')); }
// QStringView qlatin1string_does_not_compile() { return QStringView(QLatin1String("a")); }
@@ -63,31 +63,31 @@ Q_STATIC_ASSERT(!CanConvert<QByteArray>::value);
// QChar
//
-Q_STATIC_ASSERT(!CanConvert<QChar>::value);
+static_assert(!CanConvert<QChar>::value);
-Q_STATIC_ASSERT(CanConvert<QChar[123]>::value);
+static_assert(CanConvert<QChar[123]>::value);
-Q_STATIC_ASSERT(CanConvert< QString >::value);
-Q_STATIC_ASSERT(CanConvert<const QString >::value);
-Q_STATIC_ASSERT(CanConvert< QString&>::value);
-Q_STATIC_ASSERT(CanConvert<const QString&>::value);
+static_assert(CanConvert< QString >::value);
+static_assert(CanConvert<const QString >::value);
+static_assert(CanConvert< QString&>::value);
+static_assert(CanConvert<const QString&>::value);
-Q_STATIC_ASSERT(CanConvert< QStringRef >::value);
-Q_STATIC_ASSERT(CanConvert<const QStringRef >::value);
-Q_STATIC_ASSERT(CanConvert< QStringRef&>::value);
-Q_STATIC_ASSERT(CanConvert<const QStringRef&>::value);
+static_assert(CanConvert< QStringRef >::value);
+static_assert(CanConvert<const QStringRef >::value);
+static_assert(CanConvert< QStringRef&>::value);
+static_assert(CanConvert<const QStringRef&>::value);
//
// ushort
//
-Q_STATIC_ASSERT(!CanConvert<ushort>::value);
+static_assert(!CanConvert<ushort>::value);
-Q_STATIC_ASSERT(CanConvert<ushort[123]>::value);
+static_assert(CanConvert<ushort[123]>::value);
-Q_STATIC_ASSERT(CanConvert< ushort*>::value);
-Q_STATIC_ASSERT(CanConvert<const ushort*>::value);
+static_assert(CanConvert< ushort*>::value);
+static_assert(CanConvert<const ushort*>::value);
static_assert(CanConvert<QVector<ushort>>::value);
static_assert(CanConvert<QVarLengthArray<ushort>>::value);
@@ -100,15 +100,15 @@ static_assert(!CanConvert<std::list<ushort>>::value);
// char16_t
//
-Q_STATIC_ASSERT(!CanConvert<char16_t>::value);
+static_assert(!CanConvert<char16_t>::value);
-Q_STATIC_ASSERT(CanConvert< char16_t*>::value);
-Q_STATIC_ASSERT(CanConvert<const char16_t*>::value);
+static_assert(CanConvert< char16_t*>::value);
+static_assert(CanConvert<const char16_t*>::value);
-Q_STATIC_ASSERT(CanConvert< std::u16string >::value);
-Q_STATIC_ASSERT(CanConvert<const std::u16string >::value);
-Q_STATIC_ASSERT(CanConvert< std::u16string&>::value);
-Q_STATIC_ASSERT(CanConvert<const std::u16string&>::value);
+static_assert(CanConvert< std::u16string >::value);
+static_assert(CanConvert<const std::u16string >::value);
+static_assert(CanConvert< std::u16string&>::value);
+static_assert(CanConvert<const std::u16string&>::value);
static_assert(CanConvert< std::u16string_view >::value);
static_assert(CanConvert<const std::u16string_view >::value);
@@ -134,15 +134,15 @@ Q_CONSTEXPR bool CanConvertFromWCharT =
#endif
;
-Q_STATIC_ASSERT(!CanConvert<wchar_t>::value);
+static_assert(!CanConvert<wchar_t>::value);
-Q_STATIC_ASSERT(CanConvert< wchar_t*>::value == CanConvertFromWCharT);
-Q_STATIC_ASSERT(CanConvert<const wchar_t*>::value == CanConvertFromWCharT);
+static_assert(CanConvert< wchar_t*>::value == CanConvertFromWCharT);
+static_assert(CanConvert<const wchar_t*>::value == CanConvertFromWCharT);
-Q_STATIC_ASSERT(CanConvert< std::wstring >::value == CanConvertFromWCharT);
-Q_STATIC_ASSERT(CanConvert<const std::wstring >::value == CanConvertFromWCharT);
-Q_STATIC_ASSERT(CanConvert< std::wstring&>::value == CanConvertFromWCharT);
-Q_STATIC_ASSERT(CanConvert<const std::wstring&>::value == CanConvertFromWCharT);
+static_assert(CanConvert< std::wstring >::value == CanConvertFromWCharT);
+static_assert(CanConvert<const std::wstring >::value == CanConvertFromWCharT);
+static_assert(CanConvert< std::wstring&>::value == CanConvertFromWCharT);
+static_assert(CanConvert<const std::wstring&>::value == CanConvertFromWCharT);
static_assert(CanConvert< std::wstring_view >::value == CanConvertFromWCharT);
static_assert(CanConvert<const std::wstring_view >::value == CanConvertFromWCharT);
@@ -291,15 +291,15 @@ void tst_QStringView::constExpr() const
#ifdef Q_COMPILER_CONSTEXPR
{
constexpr QStringView sv;
- Q_STATIC_ASSERT(sv.size() == 0);
- Q_STATIC_ASSERT(sv.isNull());
- Q_STATIC_ASSERT(sv.empty());
- Q_STATIC_ASSERT(sv.isEmpty());
- Q_STATIC_ASSERT(sv.utf16() == nullptr);
+ static_assert(sv.size() == 0);
+ static_assert(sv.isNull());
+ static_assert(sv.empty());
+ static_assert(sv.isEmpty());
+ static_assert(sv.utf16() == nullptr);
constexpr QStringView sv2(sv.utf16(), sv.utf16() + sv.size());
- Q_STATIC_ASSERT(sv2.isNull());
- Q_STATIC_ASSERT(sv2.empty());
+ static_assert(sv2.isNull());
+ static_assert(sv2.empty());
}
{
constexpr QStringView sv = nullptr;
@@ -311,64 +311,64 @@ void tst_QStringView::constExpr() const
}
{
constexpr QStringView sv = u"";
- Q_STATIC_ASSERT(sv.size() == 0);
- Q_STATIC_ASSERT(!sv.isNull());
- Q_STATIC_ASSERT(sv.empty());
- Q_STATIC_ASSERT(sv.isEmpty());
- Q_STATIC_ASSERT(sv.utf16() != nullptr);
+ static_assert(sv.size() == 0);
+ static_assert(!sv.isNull());
+ static_assert(sv.empty());
+ static_assert(sv.isEmpty());
+ static_assert(sv.utf16() != nullptr);
constexpr QStringView sv2(sv.utf16(), sv.utf16() + sv.size());
- Q_STATIC_ASSERT(!sv2.isNull());
- Q_STATIC_ASSERT(sv2.empty());
+ static_assert(!sv2.isNull());
+ static_assert(sv2.empty());
}
{
constexpr QStringView sv = u"Hello";
- Q_STATIC_ASSERT(sv.size() == 5);
- Q_STATIC_ASSERT(!sv.empty());
- Q_STATIC_ASSERT(!sv.isEmpty());
- Q_STATIC_ASSERT(!sv.isNull());
- Q_STATIC_ASSERT(*sv.utf16() == 'H');
- Q_STATIC_ASSERT(sv[0] == QLatin1Char('H'));
- Q_STATIC_ASSERT(sv.at(0) == QLatin1Char('H'));
- Q_STATIC_ASSERT(sv.front() == QLatin1Char('H'));
- Q_STATIC_ASSERT(sv.first() == QLatin1Char('H'));
- Q_STATIC_ASSERT(sv[4] == QLatin1Char('o'));
- Q_STATIC_ASSERT(sv.at(4) == QLatin1Char('o'));
- Q_STATIC_ASSERT(sv.back() == QLatin1Char('o'));
- Q_STATIC_ASSERT(sv.last() == QLatin1Char('o'));
+ static_assert(sv.size() == 5);
+ static_assert(!sv.empty());
+ static_assert(!sv.isEmpty());
+ static_assert(!sv.isNull());
+ static_assert(*sv.utf16() == 'H');
+ static_assert(sv[0] == QLatin1Char('H'));
+ static_assert(sv.at(0) == QLatin1Char('H'));
+ static_assert(sv.front() == QLatin1Char('H'));
+ static_assert(sv.first() == QLatin1Char('H'));
+ static_assert(sv[4] == QLatin1Char('o'));
+ static_assert(sv.at(4) == QLatin1Char('o'));
+ static_assert(sv.back() == QLatin1Char('o'));
+ static_assert(sv.last() == QLatin1Char('o'));
constexpr QStringView sv2(sv.utf16(), sv.utf16() + sv.size());
- Q_STATIC_ASSERT(!sv2.isNull());
- Q_STATIC_ASSERT(!sv2.empty());
- Q_STATIC_ASSERT(sv2.size() == 5);
+ static_assert(!sv2.isNull());
+ static_assert(!sv2.empty());
+ static_assert(sv2.size() == 5);
}
{
- Q_STATIC_ASSERT(QStringView(u"Hello").size() == 5);
+ static_assert(QStringView(u"Hello").size() == 5);
constexpr QStringView sv = u"Hello";
- Q_STATIC_ASSERT(sv.size() == 5);
- Q_STATIC_ASSERT(!sv.empty());
- Q_STATIC_ASSERT(!sv.isEmpty());
- Q_STATIC_ASSERT(!sv.isNull());
- Q_STATIC_ASSERT(*sv.utf16() == 'H');
- Q_STATIC_ASSERT(sv[0] == QLatin1Char('H'));
- Q_STATIC_ASSERT(sv.at(0) == QLatin1Char('H'));
- Q_STATIC_ASSERT(sv.front() == QLatin1Char('H'));
- Q_STATIC_ASSERT(sv.first() == QLatin1Char('H'));
- Q_STATIC_ASSERT(sv[4] == QLatin1Char('o'));
- Q_STATIC_ASSERT(sv.at(4) == QLatin1Char('o'));
- Q_STATIC_ASSERT(sv.back() == QLatin1Char('o'));
- Q_STATIC_ASSERT(sv.last() == QLatin1Char('o'));
+ static_assert(sv.size() == 5);
+ static_assert(!sv.empty());
+ static_assert(!sv.isEmpty());
+ static_assert(!sv.isNull());
+ static_assert(*sv.utf16() == 'H');
+ static_assert(sv[0] == QLatin1Char('H'));
+ static_assert(sv.at(0) == QLatin1Char('H'));
+ static_assert(sv.front() == QLatin1Char('H'));
+ static_assert(sv.first() == QLatin1Char('H'));
+ static_assert(sv[4] == QLatin1Char('o'));
+ static_assert(sv.at(4) == QLatin1Char('o'));
+ static_assert(sv.back() == QLatin1Char('o'));
+ static_assert(sv.last() == QLatin1Char('o'));
constexpr QStringView sv2(sv.utf16(), sv.utf16() + sv.size());
- Q_STATIC_ASSERT(!sv2.isNull());
- Q_STATIC_ASSERT(!sv2.empty());
- Q_STATIC_ASSERT(sv2.size() == 5);
+ static_assert(!sv2.isNull());
+ static_assert(!sv2.empty());
+ static_assert(sv2.size() == 5);
constexpr char16_t *null = nullptr;
constexpr QStringView sv3(null);
- Q_STATIC_ASSERT(sv3.isNull());
- Q_STATIC_ASSERT(sv3.isEmpty());
- Q_STATIC_ASSERT(sv3.size() == 0);
+ static_assert(sv3.isNull());
+ static_assert(sv3.isEmpty());
+ static_assert(sv3.size() == 0);
}
#endif
}
@@ -394,7 +394,7 @@ void tst_QStringView::literals() const
const char16_t longhello[] =
u"Hello World. This is a much longer message, to exercise qustrlen.";
const char16_t withnull[] = u"a\0zzz";
- Q_STATIC_ASSERT(sizeof(longhello) >= 16);
+ static_assert(sizeof(longhello) >= 16);
QCOMPARE(QStringView(hello).size(), 5);
QCOMPARE(QStringView(hello + 0).size(), 5); // forces decay to pointer
diff --git a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp
index 22ee7d17b7..71f4d367fe 100644
--- a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp
+++ b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp
@@ -237,8 +237,8 @@ template <typename T> struct TypeInStruct { T type; };
void tst_QAtomicInt::alignment()
{
- Q_STATIC_ASSERT(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>));
- Q_STATIC_ASSERT(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>));
+ static_assert(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>));
+ static_assert(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>));
#ifdef Q_ATOMIC_INT32_IS_SUPPORTED
QCOMPARE(alignof(QBasicAtomicInteger<int>), alignof(TypeInStruct<int>));
diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
index bfe2a60088..a553580c30 100644
--- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
+++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
@@ -188,7 +188,7 @@ template <bool> inline void booleanHelper() { }
void tst_QAtomicIntegerXX::static_checks()
{
- Q_STATIC_ASSERT(sizeof(QAtomicInteger<T>) == sizeof(T));
+ static_assert(sizeof(QAtomicInteger<T>) == sizeof(T));
// statements with no effect
(void) QAtomicInteger<T>::isReferenceCountingNative();
diff --git a/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp b/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp
index 9e12e7ccce..bcc34a7d96 100644
--- a/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp
+++ b/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp
@@ -108,7 +108,7 @@ void tst_QAtomicPointer::warningFree()
void tst_QAtomicPointer::alignment()
{
- Q_STATIC_ASSERT(alignof(QBasicAtomicPointer<void>) == alignof(void*));
+ static_assert(alignof(QBasicAtomicPointer<void>) == alignof(void*));
}
void tst_QAtomicPointer::constructor()
diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp
index 2059cf74cf..9bdf925b00 100644
--- a/tests/auto/corelib/tools/collections/tst_collections.cpp
+++ b/tests/auto/corelib/tools/collections/tst_collections.cpp
@@ -2919,7 +2919,7 @@ public:
inline bool operator<(const Aligned4 &other) const { return i < other.i; }
friend inline size_t qHash(const Aligned4 &a) { return qHash(a.i); }
};
-Q_STATIC_ASSERT(alignof(Aligned4) % 4 == 0);
+static_assert(alignof(Aligned4) % 4 == 0);
#if defined(Q_PROCESSOR_ARM)
# if defined(Q_COMPILER_ALIGNAS) && defined(__BIGGEST_ALIGNMENT__)
@@ -2945,7 +2945,7 @@ public:
inline bool operator<(const AlignedBiggest &other) const { return i < other.i; }
friend inline int qHash(const AlignedBiggest &a) { return qHash(a.i); }
};
-Q_STATIC_ASSERT(alignof(AlignedBiggest) % BIGGEST_ALIGNMENT_TO_TEST == 0);
+static_assert(alignof(AlignedBiggest) % BIGGEST_ALIGNMENT_TO_TEST == 0);
template<typename C>
void testVectorAlignment()
diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
index 18432e51a6..aac429043d 100644
--- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
+++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
@@ -1065,7 +1065,7 @@ static Q_DECL_CONSTEXPR const uint bitsSetInNibble[] = {
0, 1, 1, 2, 1, 2, 2, 3,
1, 2, 2, 3, 2, 3, 3, 4,
};
-Q_STATIC_ASSERT(sizeof bitsSetInNibble / sizeof *bitsSetInNibble == 16);
+static_assert(sizeof bitsSetInNibble / sizeof *bitsSetInNibble == 16);
static Q_DECL_CONSTEXPR uint bitsSetInByte(quint8 byte)
{
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index c3e5d8d083..b1067e9a83 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -1124,7 +1124,7 @@ void tst_QHash::keyIterator()
// DefaultConstructible test
typedef QHash<int, int>::key_iterator keyIterator;
- Q_STATIC_ASSERT(std::is_default_constructible<keyIterator>::value);
+ static_assert(std::is_default_constructible<keyIterator>::value);
}
void tst_QHash::keyValueIterator()
diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
index b2ec6e1c1c..13f9b46eaa 100644
--- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
+++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
@@ -79,7 +79,7 @@ void tst_QHashFunctions::consistent()
void tst_QHashFunctions::initTestCase()
{
- Q_STATIC_ASSERT(int(RandomSeed) > 0);
+ static_assert(int(RandomSeed) > 0);
QTest::addColumn<uint>("seedValue");
QTest::newRow("zero-seed") << 0U;
@@ -240,7 +240,7 @@ void tst_QHashFunctions::range()
{
// verify that the input iterator category suffices:
std::stringstream sstream;
- Q_STATIC_ASSERT((std::is_same<std::input_iterator_tag, std::istream_iterator<int>::iterator_category>::value));
+ static_assert((std::is_same<std::input_iterator_tag, std::istream_iterator<int>::iterator_category>::value));
std::copy(ints, ints + numInts, std::ostream_iterator<int>(sstream, " "));
sstream.seekg(0);
std::istream_iterator<int> it(sstream), end;
diff --git a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
index b681676d09..8d4f6ce3fb 100644
--- a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
+++ b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
@@ -156,12 +156,12 @@ int Complex::liveCount = 0;
Q_DECLARE_METATYPE(Complex);
// Tests depend on the fact that:
-Q_STATIC_ASSERT(!QTypeInfo<int>::isStatic);
-Q_STATIC_ASSERT(!QTypeInfo<int>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<Movable>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Movable>::isComplex);
-Q_STATIC_ASSERT(QTypeInfo<Complex>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Complex>::isComplex);
+static_assert(!QTypeInfo<int>::isStatic);
+static_assert(!QTypeInfo<int>::isComplex);
+static_assert(!QTypeInfo<Movable>::isStatic);
+static_assert(QTypeInfo<Movable>::isComplex);
+static_assert(QTypeInfo<Complex>::isStatic);
+static_assert(QTypeInfo<Complex>::isComplex);
class tst_QLinkedList : public QObject
{
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index 9f0524c9e0..397e2b6ba6 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -861,7 +861,7 @@ void tst_QMap::keyIterator()
// DefaultConstructible test
typedef QMap<int, int>::key_iterator keyIterator;
- Q_STATIC_ASSERT(std::is_default_constructible<keyIterator>::value);
+ static_assert(std::is_default_constructible<keyIterator>::value);
}
void tst_QMap::keyValueIterator()
diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp
index 6ea1b18df2..8eeddf5320 100644
--- a/tests/auto/corelib/tools/qpair/tst_qpair.cpp
+++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp
@@ -62,34 +62,34 @@ typedef QPair<P,C> QPairPC;
typedef QPair<P,M> QPairPM;
typedef QPair<P,P> QPairPP;
-Q_STATIC_ASSERT( QTypeInfo<QPairCC>::isComplex);
-Q_STATIC_ASSERT( QTypeInfo<QPairCC>::isStatic );
+static_assert( QTypeInfo<QPairCC>::isComplex);
+static_assert( QTypeInfo<QPairCC>::isStatic );
-Q_STATIC_ASSERT( QTypeInfo<QPairCM>::isComplex);
-Q_STATIC_ASSERT( QTypeInfo<QPairCM>::isStatic );
+static_assert( QTypeInfo<QPairCM>::isComplex);
+static_assert( QTypeInfo<QPairCM>::isStatic );
-Q_STATIC_ASSERT( QTypeInfo<QPairCP>::isComplex);
-Q_STATIC_ASSERT( QTypeInfo<QPairCP>::isStatic );
+static_assert( QTypeInfo<QPairCP>::isComplex);
+static_assert( QTypeInfo<QPairCP>::isStatic );
-Q_STATIC_ASSERT( QTypeInfo<QPairMC>::isComplex);
-Q_STATIC_ASSERT( QTypeInfo<QPairMC>::isStatic );
+static_assert( QTypeInfo<QPairMC>::isComplex);
+static_assert( QTypeInfo<QPairMC>::isStatic );
-Q_STATIC_ASSERT( QTypeInfo<QPairMM>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<QPairMM>::isStatic );
+static_assert( QTypeInfo<QPairMM>::isComplex);
+static_assert(!QTypeInfo<QPairMM>::isStatic );
-Q_STATIC_ASSERT( QTypeInfo<QPairMP>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<QPairMP>::isStatic );
+static_assert( QTypeInfo<QPairMP>::isComplex);
+static_assert(!QTypeInfo<QPairMP>::isStatic );
-Q_STATIC_ASSERT( QTypeInfo<QPairPC>::isComplex);
-Q_STATIC_ASSERT( QTypeInfo<QPairPC>::isStatic );
+static_assert( QTypeInfo<QPairPC>::isComplex);
+static_assert( QTypeInfo<QPairPC>::isStatic );
-Q_STATIC_ASSERT( QTypeInfo<QPairPM>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<QPairPM>::isStatic );
+static_assert( QTypeInfo<QPairPM>::isComplex);
+static_assert(!QTypeInfo<QPairPM>::isStatic );
-Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isStatic );
+static_assert(!QTypeInfo<QPairPP>::isComplex);
+static_assert(!QTypeInfo<QPairPP>::isStatic );
-Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isPointer);
+static_assert(!QTypeInfo<QPairPP>::isPointer);
void tst_QPair::pairOfReferences()
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 8a621cd5d9..cfc1f13cb2 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -153,7 +153,7 @@ QtSharedPointer::ExternalRefCountData *refCountData(const QSharedPointer<T> &b)
QtSharedPointer::ExternalRefCountData* data;
};
// sanity checks:
- Q_STATIC_ASSERT(sizeof(QSharedPointer<T>) == sizeof(Dummy));
+ static_assert(sizeof(QSharedPointer<T>) == sizeof(Dummy));
Q_ASSERT(static_cast<const Dummy*>(static_cast<const void*>(&b))->value == b.data());
return static_cast<const Dummy*>(static_cast<const void*>(&b))->data;
}
@@ -2919,7 +2919,7 @@ struct Overloaded
void test()
{
-#define QVERIFY_CALLS(expr, base) Q_STATIC_ASSERT(sizeof(call(expr)) == base##Called)
+#define QVERIFY_CALLS(expr, base) static_assert(sizeof(call(expr)) == base##Called)
QVERIFY_CALLS(SmartPtr<Base1>{}, base1);
QVERIFY_CALLS(SmartPtr<Base2>{}, base2);
QVERIFY_CALLS(SmartPtr<const Base1>{}, base1);
diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
index d4f2b8afd5..899156545d 100644
--- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp
+++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
@@ -184,12 +184,12 @@ inline size_t qHash(const Custom &key, size_t seed = 0) { return qHash(key.i, se
Q_DECLARE_METATYPE(Custom);
// tests depends on the fact that:
-Q_STATIC_ASSERT(!QTypeInfo<int>::isStatic);
-Q_STATIC_ASSERT(!QTypeInfo<int>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<Movable>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Movable>::isComplex);
-Q_STATIC_ASSERT(QTypeInfo<Custom>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Custom>::isComplex);
+static_assert(!QTypeInfo<int>::isStatic);
+static_assert(!QTypeInfo<int>::isComplex);
+static_assert(!QTypeInfo<Movable>::isStatic);
+static_assert(QTypeInfo<Movable>::isComplex);
+static_assert(QTypeInfo<Custom>::isStatic);
+static_assert(QTypeInfo<Custom>::isComplex);
class tst_QVector : public QObject
diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index f0c5bf79a7..c1ef8e2a60 100644
--- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -87,16 +87,16 @@ private slots:
namespace {
template <typename T>
struct static_assert_trigger {
- Q_STATIC_ASSERT(( QMetaTypeId2<T>::IsBuiltIn ));
+ static_assert(( QMetaTypeId2<T>::IsBuiltIn ));
enum { value = true };
};
}
#define CHECK_BUILTIN(TYPE, ID) static_assert_trigger< TYPE >::value &&
-Q_STATIC_ASSERT(( FOR_EACH_GUI_METATYPE(CHECK_BUILTIN) true ));
+static_assert(( FOR_EACH_GUI_METATYPE(CHECK_BUILTIN) true ));
#undef CHECK_BUILTIN
-Q_STATIC_ASSERT((!QMetaTypeId2<QList<QPen> >::IsBuiltIn));
-Q_STATIC_ASSERT((!QMetaTypeId2<QMap<QString,QPen> >::IsBuiltIn));
+static_assert((!QMetaTypeId2<QList<QPen> >::IsBuiltIn));
+static_assert((!QMetaTypeId2<QMap<QString,QPen> >::IsBuiltIn));
template <int ID>
struct MetaEnumToType {};
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index 5bbf60ea79..eceb525ad0 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -1784,7 +1784,7 @@ void tst_QColor::qrgba64MemoryLayout()
QCOMPARE(rgb64.alpha(), quint16(0xcdef));
// Check in-memory order, so it can be used by things like SSE
- Q_STATIC_ASSERT(sizeof(QRgba64) == sizeof(quint64));
+ static_assert(sizeof(QRgba64) == sizeof(quint64));
quint16 memory[4];
memcpy(memory, &rgb64, sizeof(QRgba64));
QCOMPARE(memory[0], quint16(0x0123));
diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp
index c023fa3ac3..19b6adb4b3 100644
--- a/tests/auto/other/toolsupport/tst_toolsupport.cpp
+++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp
@@ -64,7 +64,7 @@ size_t pmm_to_offsetof(T K:: *pmm)
#else
size_t ret;
#endif
- Q_STATIC_ASSERT(sizeof(ret) == sizeof(pmm));
+ static_assert(sizeof(ret) == sizeof(pmm));
memcpy(&ret, &pmm, sizeof(ret));
return ret;
}
diff --git a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp
index 06522b2bd3..0c99042e10 100644
--- a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp
+++ b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp
@@ -56,10 +56,10 @@ public:
}
};
-Q_STATIC_ASSERT(( QMetaTypeId2<QSizePolicy>::IsBuiltIn));
-Q_STATIC_ASSERT((!QMetaTypeId2<QWidget*>::IsBuiltIn));
-Q_STATIC_ASSERT((!QMetaTypeId2<QList<QSizePolicy> >::IsBuiltIn));
-Q_STATIC_ASSERT((!QMetaTypeId2<QMap<QString,QSizePolicy> >::IsBuiltIn));
+static_assert(( QMetaTypeId2<QSizePolicy>::IsBuiltIn));
+static_assert((!QMetaTypeId2<QWidget*>::IsBuiltIn));
+static_assert((!QMetaTypeId2<QList<QSizePolicy> >::IsBuiltIn));
+static_assert((!QMetaTypeId2<QMap<QString,QSizePolicy> >::IsBuiltIn));
void tst_QWidgetMetaType::metaObject()