From 7745b49b2d7699334d0967d41535b1e162046860 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 15 Oct 2020 08:54:48 +0200 Subject: [PATCH] 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 --- src/corelib/global/qtypeinfo.h | 3 +++ src/corelib/kernel/qmetatype.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index b9159a2e1a6..4b29d0bf533 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -250,11 +250,14 @@ struct is_container struct has_operator_equal : std::false_type {}; template struct has_operator_equal() == std::declval()))>> : std::true_type {}; +QT_WARNING_POP // Two forward declarations template::value> diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 18d911d33b6..3b84327e911 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -2121,8 +2121,11 @@ struct BuiltinMetaType::IsBuiltIn>> template && !std::is_pointer_v)> struct QEqualityOperatorForType { +QT_WARNING_PUSH +QT_WARNING_DISABLE_FLOAT_COMPARE static bool equals(const QMetaTypeInterface *, const void *a, const void *b) { return *reinterpret_cast(a) == *reinterpret_cast(b); } +QT_WARNING_POP }; template