diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-12-06 14:49:07 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-12-19 15:03:07 +0000 |
commit | e0963f7d6a31dd26629a9553c0fe00d0c8b2f22f (patch) | |
tree | b669cf0d80bd766c5b3941358fae59a98ac44c0d /src | |
parent | e8d64811962d618a188bdaa6f7f8ba7f03d8c991 (diff) |
QLatin1/String/View: don't decay the arg() arguments
This turns const char[] arrays into const char* pointers and
therefore prevents the implicit conversion of string literals
to QString in QT_RESTRICTED_CAST_FROM_ASCII.
Fix by avoiding the decay.
Also simplify the template magic.
Manual conflict resolutions:
- QLatin1StringView → QLatin1String
- port away from C++17 std::disjunction
Change-Id: I88164a1866ac71b41d9cd1564f3a5e83d2d42aaa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ba52b29d336cc32a462306d9011b75e9948c7040)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/text/qstring.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 6c365f1b0c..f1363903f5 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -361,14 +361,11 @@ public: #endif private: template <typename T> - struct is_convertible_to_view_or_qstring_helper - : std::integral_constant<bool, + using is_convertible_to_view_or_qstring = std::integral_constant<bool, std::is_convertible<T, QString>::value || std::is_convertible<T, QStringView>::value || - std::is_convertible<T, QLatin1String>::value> {}; - template <typename T> - struct is_convertible_to_view_or_qstring - : is_convertible_to_view_or_qstring_helper<typename std::decay<T>::type> {}; + std::is_convertible<T, QLatin1String>::value + >; public: template <typename...Args> Q_REQUIRED_RESULT |