Bug 10080 - wrong header
: wrong header
Status: CLOSED FIXED
: Sisyphus
(All bugs in Sisyphus/libqt4-devel)
: unstable
: all Linux
: P2 normal
Assigned To:
:
:
:
:
:
  Show dependency tree
 
Reported: 2006-10-03 14:36 by
Modified: 2007-08-14 18:55 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2006-10-03 14:36:19
при попытке использовать findChildren
--
QList<alWidget *> children = el->findChildren<alWidget *>();
--
В режиме -O2 (то есть с включённым strict aliasing), получаю предупреждение:
--
/usr/include/qt4/QtCore/qobject.h: In function 'QList<T> qFindChildren(const
QObject*, const QString&) [with T = alWidget*]':
/usr/include/qt4/QtCore/qobject.h:145:   instantiated from 'QList<T>
QObject::findChildren(const QString&) const [with T = alWidget*]'
browser.cc:102:   instantiated from here
/usr/include/qt4/QtCore/qobject.h:369: warning: type-punning to incomplete type
might break strict-aliasing rules
---

Эксперты говорят, что это происходит из-за того что в заголовочном файле
применяется: void**
--
template<typename T>
inline QList<T> qFindChildren(const QObject *o, const QString &name)
{
    QList<T> list;
    qt_qFindChildren_helper(o, name, 0, reinterpret_cast<T>(0)->staticMetaObject,
                         reinterpret_cast<QList<void *>*>(&list));
    return list;
}
--

Возможно тут надо проконсультироваться с upstream на эту тему.

Steps to Reproduce:
1. Пишем программу:
--- L.cc
#include <QtCore/QObject> 
#include <QtCore/QList> 

int main()
{
        QObject o;
        QList<QObject*> children = o.findChildren<QObject *>();
}
---
2. Компилируем:

$ gcc -c -Wall -W -O2  -I /usr/lib/qt4/include/ L.cc 
/usr/lib/qt4/include/QtCore/qobject.h: In function 'QList<T> qFindChildren(const
QObject*, const QString&) [with T = QObject*]':
/usr/lib/qt4/include/QtCore/qobject.h:145:   instantiated from 'QList<T>
QObject::findChildren(const QString&) const [with T = QObject*]'
L.cc:7:   instantiated from here
/usr/lib/qt4/include/QtCore/qobject.h:369: warning: type-punning to incomplete
type might break strict-aliasing rules

3.
------- Comment #1 From 2007-08-14 18:55:07 -------
не воспроизводиться на libqt4-4.3.1-alt1