Make QStringLiteral and QByteArrayLiteral always return the real types
authorThiago Macieira <thiago.macieira@intel.com>
Thu, 20 Oct 2011 10:47:04 +0000 (12:47 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 23 Apr 2012 21:26:28 +0000 (23:26 +0200)
commitd631c31235dc3ab682ba5d4cbb466680d47b36f2
treef8c3ed874572caa33fa632451fa31b0b4ea354b1
parent33371c016e13dadcf7535e11e38065ab193b2c6e
Make QStringLiteral and QByteArrayLiteral always return the real types

Up until now, the macros would return an internal type that contained
the pointer to the data. This breaks code that tried to use the macros
with operators, like QStringBuilder but also when writing:

     QStringList() << QStringLiteral("a") << QStringLiteral("b");

This change seems to work fine now and I can also verify that this
works:

     const auto str = QStringLiteral("Hello");

Even though it creates a QString, which is non-POD and non-constexpr.

Change-Id: Iaf82af9bea4245513a1128ea54f9d2d3d785fb09
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
src/corelib/tools/qbytearray.h
src/corelib/tools/qstring.h
src/corelib/tools/qstringbuilder.h
tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp