From 8ccae33a8114ea7da49701b5d7c9f6733a219711 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 7 Oct 2020 15:19:26 +0200 Subject: [PATCH] Fix compilation on MSVC with /std:c++latest Inline the definition of QMetaTypeForType::name and make it constexpr. The old code was conflicting in it's definition (only const in the declaration, constexpr in the definition), something MSVC didn't like. Fixes: QTBUG-87225 Change-Id: I7182c421c9f7612e4ff3d538829b2daee0fe4c5c Reviewed-by: Thiago Macieira --- src/corelib/kernel/qmetatype.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 971388fabd..a6631dc2d9 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -2111,7 +2111,7 @@ struct QDataStreamOperatorForType template class QMetaTypeForType { - static const decltype(typenameHelper()) name; + static constexpr decltype(typenameHelper()) name = typenameHelper(); template static constexpr QMetaTypeInterface::DefaultCtrFn getDefaultCtr() @@ -2200,14 +2200,9 @@ QMetaTypeInterface QMetaTypeForType::metaType = { /*.legacyRegisterOp=*/ getLegacyRegister() }; -template -constexpr const decltype(typenameHelper()) QMetaTypeForType::name = typenameHelper(); - template<> class QMetaTypeForType { - static const decltype(typenameHelper()) name; - public: static inline QMetaTypeInterface metaType = {