QStringBuilder: fix warning about memcpying onto QChar
Which is not a trivial class. qstringbuilder.h: In instantiation of 'static void QConcatenable<const char16_t [N]>::appendTo(const char16_t*, QChar*&) [with long long int N = 6]': qstringbuilder.h:402:35: required from 'static void QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::appendTo(const type&, T*&) [with T = QChar; A = char16_t [6]; B = QString; QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::type = QStringBuilder<char16_t [6], QString>]' qstringbuilder.h:460:52: required from 'QString& operator+=(QString&, const QStringBuilder<A, B>&) [with A = char16_t [6]; B = QString]' /home/tjmaciei/src/qt/qt6-release/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:1762:75: required from here qstringbuilder.h:338:15: error: 'void* memcpy(void*, const void*, size_t)' copying an object of non-trivial type 'class QChar' from an array of 'const char16_t' [-Werror=class-memaccess] Change-Id: Iddb933f281024939b6acfffd1689cf320c84873c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit a20a4240668faa0e6c961b90266918628f9f5484) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
42e1abccd0
commit
64d3b9f6d1
@ -335,7 +335,7 @@ template <qsizetype N> struct QConcatenable<const char16_t[N]> : private QAbstra
|
|||||||
static qsizetype size(const char16_t[N]) { return N - 1; }
|
static qsizetype size(const char16_t[N]) { return N - 1; }
|
||||||
static void appendTo(const char16_t a[N], QChar *&out)
|
static void appendTo(const char16_t a[N], QChar *&out)
|
||||||
{
|
{
|
||||||
memcpy(out, a, (N - 1) * sizeof(char16_t));
|
memcpy(static_cast<void *>(out), a, (N - 1) * sizeof(char16_t));
|
||||||
out += N - 1;
|
out += N - 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user