Does anyone have a suggestion on how to fix this warning?

This code in qlist.h:

  409: template <typename T>
  410: Q_INLINE_TEMPLATE void QList<T>::node_destruct(Node *from, Node *to)
  411: {
  412:    if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic)
  413:        while(from != to) --to, delete reinterpret_cast<T*>(to->v);
  414:    else if (QTypeInfo<T>::isComplex)
  415:        while (from != to) --to, reinterpret_cast<T*>(to)->~T();
  416: }

...when compiled for ARM, causes this warning (or error with -Werror):

  src/corelib/tools/qlist.h: In member function ‘void 
QList<T>::node_destruct(QList<T>::Node*, QList<T>::Node*) [with T = QVariant]’:
  src/corelib/tools/qlist.h:738:5:   instantiated from ‘void 
QList<T>::dealloc(QListData::Data*) [with T = QVariant]’
  src/corelib/tools/qlist.h:714:9:   instantiated from ‘QList<T>::~QList() 
[with T = QVariant]’
  src/corelib/statemachine/qstatemachine.h:81:59:   instantiated from here
  src/corelib/tools/qlist.h:415:28: error: cast from ‘QList<QVariant>::Node*’ 
to ‘QVariant*’ increases required alignment of target type [-Werror=cast-align]

"do not compile with -Wcast-align" may be a valid answer, but it would
be good to hear from someone who can confidently say whether or not this
issue can actually harm us in practice.
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to