QArrayData: stop using std::is_literal_type

The trait is deprecated in C++17 and removed in C++20. Enforce
the same meaning by using a constexpr variable instead.

Change-Id: Ief13afc3f889af09094391e626037778d879c4f5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2020-06-08 16:46:26 +02:00
parent 8edf11d510
commit c55f45e875

View File

@ -288,20 +288,12 @@ struct QTypedArrayData
}()) \
/**/
#ifdef Q_COMPILER_CONSTEXPR
#define Q_ARRAY_LITERAL_CHECK_LITERAL_TYPE(Type) Q_STATIC_ASSERT(std::is_literal_type<Type>::value)
#else
#define Q_ARRAY_LITERAL_CHECK_LITERAL_TYPE(Type) do {} while (0)
#endif
#define Q_ARRAY_LITERAL_IMPL(Type, ...) \
Q_ARRAY_LITERAL_CHECK_LITERAL_TYPE(Type); \
\
/* Portable compile-time array size computation */ \
static Type const data[] = { __VA_ARGS__ }; \
static constexpr Type data[] = { __VA_ARGS__ }; \
enum { Size = sizeof(data) / sizeof(data[0]) }; \
\
static const QArrayData literal = { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 }; \
static constexpr QArrayData literal = { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 };\
\
QArrayDataPointerRef<Type> ref = \
{ static_cast<QTypedArrayData<Type> *>( \