path: root/src
diff options
authorJanne Anttila <>2013-04-17 14:26:37 +0300
committerThe Qt Project <>2013-05-30 17:01:12 +0200
commit20d08a96c8240a9fda1a359d98be42f69ed9592e (patch)
tree31fb744074ed29c14c219b5913cfa33a2050851f /src
parentde3d449dcff4ee00fea72b3697055f5459fb13ec (diff)
Fix tst_qtendian autotest build for WEC7.
MSVC2008 compiler fo ARM targets fail to compile qToUnaligned when using sizeof(T) inside memcpy fynction. The compiler fails at least when the code is reached through the following macros and templates: -> tst_QtEndian::toLittleEndian -> qToLittleEndian(T src, uchar *dest) -> qToUnaligned(const T src, uchar *dest) The above sequence produces internal compiler error with MSVC2008/ARM builds when called from tst_endian. As a workaround sizeof(T) is called outside memcpy function. Change-Id: Ib4d382c2cebecb6e54bb99fc8fad72db93825fcd Reviewed-by: Oswald Buddenhagen <>
Diffstat (limited to 'src')
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index c9c4d23aab..9b939feea0 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -78,7 +78,10 @@ template <typename T> inline void qbswap(const T src, uchar *dest)
// If you want to avoid the memcopy, you must write specializations for this function
template <typename T> inline void qToUnaligned(const T src, uchar *dest)
- memcpy(dest, &src, sizeof(T));
+ // Using sizeof(T) inside memcpy function produces internal compiler error with
+ // MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T.
+ const size_t size = sizeof(T);
+ memcpy(dest, &src, size);
/* T qFromLittleEndian(const uchar *src)