[PyQt] SIP template-based class with argument having default constructor as default value

Denis Rouzaud denis.rouzaud at gmail.com
Tue Jun 13 19:50:55 BST 2017


Hi Shaheed,

Thanks a lot for your feedback.
Is there a place to report issues?

Cheers
Denis

Le mar. 13 juin 2017 à 19:23, Shaheed Haque <srhaque at theiet.org> a écrit :

> On 13 June 2017 at 15:16, Denis Rouzaud <denis.rouzaud at gmail.com> wrote:
> >
> > Hi all,
> >
> > Title says it all ;)
> >
> > I think there is an issue on how SIP handles the default value argument
> for
> > template-based classes.
> > SIP don't replaces the T var by the implemented  base class constructor.
> See
> > below.
> >
> > Let's say I have
> >
> > template <typename T>
> > class Base
> > {
> >   pubic:
> >     Base( const T &epoch = T()) : mEpoch( epoch ){}
> >   private:
> >     T mEpoch;
> > }
> >
> > typedef Base< QDate > MyDate;
> > typedef Base< QDateTime > MyDateTime;
> >
> >
> > Here is the SIP code generated:
> >
> > static void *init_type_MyDate(sipSimpleWrapper *, PyObject *sipArgs,
> > PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject
> > **sipParseErr)
> > {
> >     MyDate *sipCpp = 0;
> >     {
> >         const QDate& a0def = T();
> >         const QDate* a0 = &a0def;
> >         int a0State = 0;
> > ......
> >
> >
> > I get an error:
> > use of undeclared identifier 'T'
> >      in   const QDate& a0def = T();
> >
> >
> > Does someone confirm?
>
>
> I see it too:
>
> /tmp/tmpQYVtIS/tmp2/tmp/PySample/sipPySampleQStringBase.cpp:96:37:
> error: ‘T’ was not declared in this scope
>          const  ::QString& a0def = T();
>
>
> > Is there a workaround?
> > Cheers,
> > Denis
> >
> >
> >
> > _______________________________________________
> > PyQt mailing list    PyQt at riverbankcomputing.com
> > https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170613/239d5cc1/attachment.html>


More information about the PyQt mailing list