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 <fabian.kosmale@qt.io>
bb10
Marc Mutz 2022-02-06 10:13:24 +01:00
parent e128ed2c5d
commit 38d2f60f9a
1 changed files with 1 additions and 1 deletions

View File

@ -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();