[mythtv] libMyth fails to build in managedlist.cpp/h
Anduin Withers
awithers at anduin.com
Thu Jul 3 17:34:55 UTC 2008
> In file included from managedlist.cpp:7:
> /usr/local/Trolltech/Qt-4.4.0/include/QtCore/qpointer.h: In member
> function `
> QPointer<T>::operator T*() const [with T = ManagedList]':
> managedlist.h:42: instantiated from here
> /usr/local/Trolltech/Qt-4.4.0/include/QtCore/qpointer.h:80: error: invalid
> static_cast from type `QObject*' to type `ManagedList*'
It should not be related to your Qt version (in this instance), probably some mix of compiler version/options.
ManagedList is forward declared at the top of managedlist.h, when one instantiates QPointer<ManagedList>::operator T*() in ManagedListItem::getParentList(), well the QPointer template would be unaware of ManagedList's inheritance from QObject.
Essentially the difference between:
struct base {};
template <typename T> struct qp { operator T*() { base *ret = 0; return static_cast<T *>(ret);}};
struct d;
int main() { qp<d> dinst; d *p = dinst; }
struct d : public base {};
and
struct base {};
template <typename T> struct qp { operator T*() { base *ret = 0; return static_cast<T *>(ret);}};
struct d : public base {};
int main() { qp<d> dinst; d *p = dinst; }
So, which compiler version are you using?
And yes, things should probably be moved around.
--
Anduin Withers
More information about the mythtv-dev
mailing list