Hi,

I just debugged a quite weird bug with QueuedConnection and foinction pointer 
base connection. 

There is a compiler bug in clang 3.4 with precompiled header.
Normally, a static variable within a template should have a different address 
for different template parameters .
In other words:
template<typename T> int *foo() { static int i; return &i; }
so foo<int>() != foo<double>()

However, if foo is in a precompiled header, this is not the case.

And this breaks the detection of the QMetaType for the QueuedConnection since 
we rely on static variables different for each types.
http://code.woboq.org/qt5/qtbase/src/corelib/kernel/qobject_impl.h.html#105

As a result, Qt believe the metatypes are not what they are, resulting in 
wrong type conversions, and weird crash when the event is received.

The bug is fixed in Clang 3.5. (not released yet)
I don't know if it was present in earlier version of clang.

Should precompiled header be disabled by default for this compiler version?

-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org
#include <cassert>
int main() {
    assert(F<int>::foo() != F<double>::foo());
}

// clang -x c++-header t.h -o t.h.pch  &&   clang++ ./t.cpp  -Wall -include t.h  && ./a.out
#ifndef ABC
#define ABC
template <typename T> struct F {
    static const int *foo() {
        static int t;
        return &t;
    }
};
#endif
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to