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 <hjk@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Alexander Volkov 2017-11-16 12:40:21 +03:00
parent 4c704fad08
commit a6b7447058

View File

@ -675,8 +675,12 @@ public:
: d(fromAscii_helper(ch, N - 1))
{}
template <int N>
QString(char (&)[N]) = delete;
template <int N>
inline QString &operator=(const char (&ch)[N])
{ return (*this = fromUtf8(ch, N - 1)); }
template <int N>
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)