From 38d2f60f9aa7383817247bb66a625d1209d623b2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 6 Feb 2022 10:13:24 +0100 Subject: [PATCH] QPropertyBindingSourceLocation: make (source_location) ctor constexpr The typical argument, source_location::current(), is consteval, so it cannot actually be used outside constexpr contexts. Having a non-consteval, non-constexpr ctor to accept the return value is conceptually wrong, as a constexpr-only result is forced though a non-constexpr function. It may even trigger MSVC's consteval bug: https://developercommunity.visualstudio.com/t/Cannot-use-std::source_location-in-C-m/1436152 because the work-around given, wrapping in a lambda, means wrapping the result in a constexpr context, and that may just be the root cause of the issue. Pick-to: 6.3 6.2 Change-Id: I49534cf86f32e16b13d7e169cd5cb0c8fc374d69 Reviewed-by: Fabian Kosmale --- src/corelib/kernel/qproperty.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index 5258e4533b..abf88076dd 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -112,7 +112,7 @@ struct Q_CORE_EXPORT QPropertyBindingSourceLocation quint32 column = 0; QPropertyBindingSourceLocation() = default; #ifdef QT_PROPERTY_COLLECT_BINDING_LOCATION - QPropertyBindingSourceLocation(const QT_SOURCE_LOCATION_NAMESPACE::source_location &cppLocation) + constexpr QPropertyBindingSourceLocation(const QT_SOURCE_LOCATION_NAMESPACE::source_location &cppLocation) { fileName = cppLocation.file_name(); functionName = cppLocation.function_name();