The bug does not appear with 4.5 if a workaround is used. At the end of the macro body get the volatile int field explicitely and return that.
--- kernel/qmetatype.h 2011-02-08 14:48:27.000000000 +0200 +++ qmetatype.h 2011-02-08 14:49:14.000000000 +0200 @@ -276,7 +276,8 @@ if (!metatype_id) \ metatype_id = qRegisterMetaType< TYPE >(#TYPE, \ reinterpret_cast< TYPE *>(quintptr(-1))); \ - return metatype_id; \ + volatile int mid = metatype_id;\ + return mid; \ } \ }; \ QT_END_NAMESPACE
The bug does not appear with 4.5 if a workaround is used.
At the end of the macro body get the volatile int field explicitely and return that.
--- kernel/qmetatype.h 2011-02-08 14:48:27.000000000 +0200
metatype_ id = qRegisterMetaType< TYPE >(#TYPE, \
reinterpret _cast< TYPE *>(quintptr(-1))); \ END_NAMESPACE
+++ qmetatype.h 2011-02-08 14:49:14.000000000 +0200
@@ -276,7 +276,8 @@
if (!metatype_id) \
- return metatype_id; \
+ volatile int mid = metatype_id;\
+ return mid; \
} \
}; \
QT_