Details
-
Suggestion
-
Resolution: Out of scope
-
P2: Important
-
4.4.1
-
None
Description
As reproducible with the following example, which should not compile. It does not compile when QT_NO_CAST_FROM_ASCII/QT_NO_CAST_TO_ASCII are not set.
#define QT_NO_CAST_FROM_ASCII #define QT_NO_CAST_TO_ASCII #include <QtCore/QString> int main(int argc, char* argv[]) { QString q; bool b = q == NULL; return 0; }
NULL gets implicitly converted into a QStringRef, which then executes the following comparison operator:
bool operator==(const QString &s1,const QStringRef &s2)
It might be possible to fix this by making the following c'tor explicit:
inline QStringRef::QStringRef(const QString *aString)
:m_string(aString), m_position(0), m_size(aString?aString->size() : 0){}