Skip to content

Commit

Permalink
QProperty: only use MSVC bug workaround on MSVC
Browse files Browse the repository at this point in the history
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.

Pick-to: 6.4 6.2
Fixes: QTBUG-108039
Change-Id: If6a0ce6e8f41e9dc752614557e96c555ca0fe75c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
  • Loading branch information
Inkane committed Oct 31, 2022
1 parent c4cb464 commit 62a2951
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/corelib/kernel/qproperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 62a2951

Please sign in to comment.