From cab764871cc9379ca9757f41dca9e3ed9e9d34aa Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 24 Feb 2010 18:21:09 +0100 Subject: suppress pointer aliasing warnings the code as such is safe, as no aliasing can occur here. so it is just a matter of making the compiler shut up. Reviewed-by: Olivier Goffart --- src/corelib/tools/qlist.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 3a29e13..02d434e 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -525,7 +525,8 @@ Q_OUTOFLINE_TEMPLATE void QList::append(const T &t) PodNode cpy = *reinterpret_cast(&t); Node *n = reinterpret_cast(p.append()); QT_TRY { - node_construct(n, *reinterpret_cast(&cpy)); + void *ptr = &cpy; + node_construct(n, *reinterpret_cast(ptr)); } QT_CATCH(...) { --d->end; QT_RETHROW; @@ -559,7 +560,8 @@ inline void QList::prepend(const T &t) PodNode cpy = *reinterpret_cast(&t); Node *n = reinterpret_cast(p.prepend()); QT_TRY { - node_construct(n, *reinterpret_cast(&cpy)); + void *ptr = &cpy; + node_construct(n, *reinterpret_cast(ptr)); } QT_CATCH(...) { ++d->begin; QT_RETHROW; @@ -593,7 +595,8 @@ inline void QList::insert(int i, const T &t) PodNode cpy = *reinterpret_cast(&t); Node *n = reinterpret_cast(p.insert(i)); QT_TRY { - node_construct(n, *reinterpret_cast(&cpy)); + void *ptr = &cpy; + node_construct(n, *reinterpret_cast(ptr)); } QT_CATCH(...) { p.remove(i); QT_RETHROW; -- cgit v0.12