Compile QLatin1String with C++11

qstring.h: In constructor ‘QLatin1String::QLatin1String(const QByteArray&)’:
qstring.h:667:129: error: ‘const char* QByteArray::constData() const’ is not ‘constexpr’

QByteArray has a destructor and therefore cannot be used in constexpr,
so do not mark it as constexpr

Change-Id: I037e9ae73a244660923eac791cc3e0082d1d7a63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Olivier Goffart 2012-03-16 17:59:43 +01:00 committed by Qt by Nokia
parent 3abc6be685
commit 09348c3efb

View File

@ -664,7 +664,7 @@ class QLatin1String
public:
Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s) : m_size(s ? int(strlen(s)) : 0), m_data(s) {}
Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s, int sz) : m_size(sz), m_data(s) {}
Q_DECL_CONSTEXPR inline explicit QLatin1String(const QByteArray &s) : m_size(strlen(s.constData())), m_data(s.constData()) {}
inline explicit QLatin1String(const QByteArray &s) : m_size(strlen(s.constData())), m_data(s.constData()) {}
inline const char *latin1() const { return m_data; }
inline int size() const { return m_size; }