diff options
-rw-r--r-- | src/corelib/global/qfloat16.cpp | 13 | ||||
-rw-r--r-- | src/corelib/global/qfloat16.h | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index fd608efe55..87ff796368 100644 --- a/src/corelib/global/qfloat16.cpp +++ b/src/corelib/global/qfloat16.cpp @@ -65,6 +65,19 @@ QT_BEGIN_NAMESPACE */ /*! + \macro QT_NO_FLOAT16_OPERATORS + \relates <QFloat16> + \since 5.12.4 + + Defining this macro disables the arithmetic operators for qfloat16. + + This is only necessary on Visual Studio 2017 (and earlier) when including + \c {<QFloat16>} and \c{<bitset>} in the same translation unit, which would + otherwise cause a compilation error due to a toolchain bug (see + [QTBUG-72073]). +*/ + +/*! Returns true if the \c qfloat16 \a {f} is equivalent to infinity. \relates <QFloat16> diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index 3e50ad8467..b76d2b9616 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -83,7 +83,9 @@ private: Q_CORE_EXPORT static const quint32 shifttable[]; friend bool qIsNull(qfloat16 f) Q_DECL_NOTHROW; +#if !defined(QT_NO_FLOAT16_OPERATORS) friend qfloat16 operator-(qfloat16 a) Q_DECL_NOTHROW; +#endif }; Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE); @@ -165,6 +167,7 @@ inline qfloat16::operator float() const Q_DECL_NOTHROW } #endif +#if !defined(QT_NO_FLOAT16_OPERATORS) inline qfloat16 operator-(qfloat16 a) Q_DECL_NOTHROW { qfloat16 f; @@ -246,6 +249,7 @@ QF16_MAKE_BOOL_OP_INT(!=) #undef QF16_MAKE_BOOL_OP_INT QT_WARNING_POP +#endif // QT_NO_FLOAT16_OPERATORS /*! \internal |