From c55f45e875ece0624f549b0ead9d72803434931a Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 8 Jun 2020 16:46:26 +0200 Subject: [PATCH] QArrayData: stop using std::is_literal_type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/corelib/tools/qarraydata.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index d996b9c56b8..b6fc05e1082 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -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::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 ref = \ { static_cast *>( \