[cfe-dev] False warning in recent clang

Konstantin Tokarev annulen at yandex.ru
Fri Jun 22 04:30:15 PDT 2012


Hi all,

After recent clang update I'm getting new warnings from Qt headers:

/usr/local/Trolltech/Qt-4.8.0/include/QtCore/qsharedpointer_impl.h:595:43: warning: field is uninitialized when used here [-Wuninitialized]
    inline QWeakPointer(X *ptr) : d(ptr ? d->getAndRef(ptr) : 0), value(ptr)
                                          ^

(caret is pointing at 'd' before '->getAndRef')

Here is complete piece of subject code:

template <class X>
inline QWeakPointer(X *ptr) : d(ptr ? d->getAndRef(ptr) : 0), value(ptr)
{ }

where getAndRef is static method, so value of d is not needed here. I assume this warning should not be emitted.

-- 
Regards,
Konstantin



More information about the cfe-dev mailing list