summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstring.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-12-06 14:49:07 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-12-17 07:18:07 +0000
commitba52b29d336cc32a462306d9011b75e9948c7040 (patch)
treee486e0d5f3a74d5c6ad703a984c4bcf78f95f6b3 /src/corelib/text/qstring.h
parent67d7d8746c97e0230728495b9cf615ef84c154bc (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. Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I88164a1866ac71b41d9cd1564f3a5e83d2d42aaa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qstring.h')
-rw-r--r--src/corelib/text/qstring.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index 62f0e078ee..883fc08d3c 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -538,14 +538,11 @@ public:
QChar fillChar = u' ') const;
private:
template <typename T>
- struct is_convertible_to_view_or_qstring_helper
- : std::integral_constant<bool,
- std::is_convertible<T, QString>::value ||
- std::is_convertible<T, QStringView>::value ||
- std::is_convertible<T, QLatin1StringView>::value> {};
- template <typename T>
- struct is_convertible_to_view_or_qstring
- : is_convertible_to_view_or_qstring_helper<typename std::decay<T>::type> {};
+ using is_convertible_to_view_or_qstring = std::disjunction<
+ std::is_convertible<T, QString>,
+ std::is_convertible<T, QStringView>,
+ std::is_convertible<T, QLatin1StringView>
+ >;
public:
template <typename...Args>
[[nodiscard]]