summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-10-15 08:54:48 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-10-16 13:53:02 +0200
commit7745b49b2d7699334d0967d41535b1e162046860 (patch)
tree219b3cff6c32ffa34bc6916d64a041b9b8a54ebe /src
parentb3f3ebc2c0c9ba4142d553d02c86497377f4b3ef (diff)
QMetaType: Silence float comparison warnings in QEqualityOperatorForType
We actually do want to invoke the original equality operator there. If that is unsafe, we cannot do much about it at this point. Change-Id: Iadb2eaba1156828d89022d282c41bda57b500b13 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qtypeinfo.h3
-rw-r--r--src/corelib/kernel/qmetatype.h3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h
index b9159a2e1a..4b29d0bf53 100644
--- a/src/corelib/global/qtypeinfo.h
+++ b/src/corelib/global/qtypeinfo.h
@@ -250,11 +250,14 @@ struct is_container<T, std::void_t<
// Checks the existence of the comparison operator for the class itself
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_FLOAT_COMPARE
template <typename, typename = void>
struct has_operator_equal : std::false_type {};
template <typename T>
struct has_operator_equal<T, std::void_t<decltype(bool(std::declval<const T&>() == std::declval<const T&>()))>>
: std::true_type {};
+QT_WARNING_POP
// Two forward declarations
template<typename T, bool = is_container<T>::value>
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 18d911d33b..3b84327e91 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -2121,8 +2121,11 @@ struct BuiltinMetaType<T, std::enable_if_t<QMetaTypeId2<T>::IsBuiltIn>>
template<typename T, bool = (QTypeTraits::has_operator_equal_v<T> && !std::is_pointer_v<T>)>
struct QEqualityOperatorForType
{
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_FLOAT_COMPARE
static bool equals(const QMetaTypeInterface *, const void *a, const void *b)
{ return *reinterpret_cast<const T *>(a) == *reinterpret_cast<const T *>(b); }
+QT_WARNING_POP
};
template<typename T>