qt6-bb10/tests/manual/qmetatype
Marc Mutz 98b77f9faa QMetaType: remember whether a type was registered with Q_DECLARE_METATYPE
There are two ways to register a type: using Q_DECLARE_METATYPE(T) and
using qRegisterMetaType<T>("T"). Doing one thing in one translation
unit and another thing in another TU constitutes an ODR violation,
because the value of QMetaTypeId<T>::Defined will differ in the two
TUs.

By adding the information whether a type was declared with
Q_DECLARE_METATYPE to the typeFlags(), such a use will trigger
the existing binary-incompatibility failure that checks for
equality of the incoming type flags with the stored ones (if any).

I had to encode the type as a defaulted function argument in order
to avoid the linker merging instantiations of the function templates
and therefore rendering the detection moot.

Change-Id: I82017caf300458b411cc8ac2f6653536fac64117
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-12-11 11:12:08 +01:00
..
declare_metatype_noninline.cpp QMetaType: remember whether a type was registered with Q_DECLARE_METATYPE 2012-12-11 11:12:08 +01:00
declare_metatype_noninline.h QMetaType: remember whether a type was registered with Q_DECLARE_METATYPE 2012-12-11 11:12:08 +01:00
qmetatype.pro QMetaType: remember whether a type was registered with Q_DECLARE_METATYPE 2012-12-11 11:12:08 +01:00
tst_qmetatype.cpp QMetaType: remember whether a type was registered with Q_DECLARE_METATYPE 2012-12-11 11:12:08 +01:00