On quarta-feira, 7 de março de 2012 09.34.35, Rohan McGovern wrote:
> 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: }

> src/corelib/tools/qlist.h:415:28: error: cast from
> ‘QList<QVariant>::Node*’ to ‘QVariant*’ increases required alignment of
> target type [-Werror�st-align]

QList<QVariant>::Node is {
    void *v;
}; (sizeof == 4, alignof == 4)

QVariant is {
    struct Private {
        union Data {
            // among other things
            qlonglong ll;
            qulonglong ull;
            double d;
        };
        uint type;
    } d;
} (sizeof == 12, alignof == 8)

There is an increased alignment requirement in there. However, the side of the
branch being considered, line 415, is never executed because isLarge == true.
So this warning is a false positive on a line that gets never compiled.

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to