[Development] QMetaTypeId<void>::Defined illegal in Qt 5.5 beta
olivier at woboq.com
Sat May 16 12:34:06 CEST 2015
On Saturday 16. May 2015 11:12:48 Roland Winklmeier wrote:
> Hi all,
> I was testing the Qt 5.5 beta binaries with my application and quickly
> run into the following issue:
> Short version:
> The expression "QMetaTypeId<void>::Defined" seems to be no longer
> allowed in 5.5. It is fine until 5.4.2 (or more precise until
> Is this intended behaviour or an accepted source incompatibility since
> QMetaTypeId is part of the private API?
This was not intentional.
I made a fix here: https://codereview.qt-project.org/112436
However, this is part of the private API and that breakage at this level are
accepted. (in this case it's just easy to solve)
> Long Version:
> Attached is a small example to reproduce the compiler error .
> QMetaTypeId<T>::Defined is often used by users of Qt to write
> conditional code. As far as I know it is the only method to find out at
> compile time whether T was declared as Qt meta type or not. In the
> project I'm working on, most of the classes have a common base class
> CValueObject which helps with automatic registration as Qt Meta Type,
> DBus Meta Type, etc. In here we are using some template magic
> conditional on "QMetaTypeId< typename SomeMagic<T>::type>::Defined".
> SomeMagic<T>::type defaults to void, if T does not fulfil specific type
> requirements. Unfortunately, we cannot simply change the default to
> void* without rewriting a lot.
You should never use QMetaTypeId directly. Not only because it is private API,
but also because QMetaTypeId2 has to be used instead for this purpose,
otherwise you will be missing built-in types. (But QMetaTypeId2 is also
Maybe we should provide some public API for this as this seems to be something
that is useful.
Woboq - Qt services and support - http://woboq.com - http://code.woboq.org
More information about the Development