[Development] Compiler bug in Clang 3.4 with precompiled header with QueuedConnection

Olivier Goffart olivier at woboq.com
Mon Jul 21 23:12:04 CEST 2014


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.

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?


Woboq - Qt services and support - http://woboq.com - http://code.woboq.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.cpp
Type: text/x-c++src
Size: 173 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140721/b7587d05/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.h
Type: text/x-chdr
Size: 144 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140721/b7587d05/attachment.h>

More information about the Development mailing list