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 <thiago.macieira@intel.com>
This commit is contained in:
Lars Knoll 2020-10-07 15:19:26 +02:00
parent 564b59d903
commit 8ccae33a81

View File

@ -2111,7 +2111,7 @@ struct QDataStreamOperatorForType <T, false>
template<typename S>
class QMetaTypeForType
{
static const decltype(typenameHelper<S>()) name;
static constexpr decltype(typenameHelper<S>()) name = typenameHelper<S>();
template<typename T>
static constexpr QMetaTypeInterface::DefaultCtrFn getDefaultCtr()
@ -2200,14 +2200,9 @@ QMetaTypeInterface QMetaTypeForType<T>::metaType = {
/*.legacyRegisterOp=*/ getLegacyRegister<T>()
};
template<typename T>
constexpr const decltype(typenameHelper<T>()) QMetaTypeForType<T>::name = typenameHelper<T>();
template<>
class QMetaTypeForType<void>
{
static const decltype(typenameHelper<void>()) name;
public:
static inline QMetaTypeInterface metaType =
{