summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2022-10-31 08:36:59 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-10-31 18:44:58 +0000
commitef581555b3092bfc0542dc5d15cab83c531a9260 (patch)
tree959244b5a5e887dfece01699ddb49e32a02a7b4f
parent7484585ffa862b2b97d7f59a191b239f9c26ac80 (diff)
QProperty: only use MSVC bug workaround on MSVC
The fix for QTBUG-106277 appears to cause issues with older gcc versions in C++2a mode (for instance used in our headers check). Thus, use the old code for all non-MSVC compilers, which never had problems with it. Fixes: QTBUG-108039 Change-Id: If6a0ce6e8f41e9dc752614557e96c555ca0fe75c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 62a2951795f117ff10a6d85bcff8d93a71fd58da) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/corelib/kernel/qproperty.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h
index 82ef16caba..4968b29cee 100644
--- a/src/corelib/kernel/qproperty.h
+++ b/src/corelib/kernel/qproperty.h
@@ -18,7 +18,16 @@
#if defined(__cpp_lib_source_location)
#define QT_SOURCE_LOCATION_NAMESPACE std
#define QT_PROPERTY_COLLECT_BINDING_LOCATION
-#define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation::fromStdSourceLocation(std::source_location::current())
+#if defined(Q_CC_MSVC)
+/* MSVC runs into an issue with constexpr with source location (error C7595)
+ so use the factory function as a workaround */
+# define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation::fromStdSourceLocation(std::source_location::current())
+#else
+/* some versions of gcc in turn run into
+ expression ‘std::source_location::current()’ is not a constant expression
+ so don't use the workaround there */
+# define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation(std::source_location::current())
+#endif
#endif
#endif