From a6b7447058f42e9b592644b85e37b5705e6aa675 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 16 Nov 2017 12:40:21 +0300 Subject: Disable some implicit conversions with QT_RESTRICTED_CAST_FROM_ASCII Non-const arrays are not literals, so their encoding may be not defined at compile-time and they should be converted explicitly. Change-Id: I2a65e095224f48efafeaa97fd85134697a1e5bf0 Reviewed-by: hjk Reviewed-by: Thiago Macieira --- src/corelib/tools/qstring.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index b411bdac5a..af1513442a 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -675,8 +675,12 @@ public: : d(fromAscii_helper(ch, N - 1)) {} template + QString(char (&)[N]) = delete; + template inline QString &operator=(const char (&ch)[N]) { return (*this = fromUtf8(ch, N - 1)); } + template + QString &operator=(char (&)[N]) = delete; #endif #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) inline QT_ASCII_CAST_WARN QString(const char *ch) -- cgit v1.2.3