From 567765ff529d6d4aa0f5d9788a765b5bce0fe3d0 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 6 Dec 2022 14:49:07 +0100 Subject: [PATCH] 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. Change-Id: I88164a1866ac71b41d9cd1564f3a5e83d2d42aaa Reviewed-by: Thiago Macieira (cherry picked from commit ba52b29d336cc32a462306d9011b75e9948c7040) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qstring.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 62f0e078eed..883fc08d3c1 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -538,14 +538,11 @@ public: QChar fillChar = u' ') const; private: template - struct is_convertible_to_view_or_qstring_helper - : std::integral_constant::value || - std::is_convertible::value || - std::is_convertible::value> {}; - template - struct is_convertible_to_view_or_qstring - : is_convertible_to_view_or_qstring_helper::type> {}; + using is_convertible_to_view_or_qstring = std::disjunction< + std::is_convertible, + std::is_convertible, + std::is_convertible + >; public: template [[nodiscard]]