...and I have no SIP skills at all, so thanks for the clarification.
This seems to satisfy GCC 4 and GCC 3.3.4 both:

        KURL::List           operator + (const KURL::List&);
%MethodCode
//returns (KURL.List)
//takes listToAdd | (KURL.List)
    Py_BEGIN_ALLOW_THREADS
    sipRes = new KURL::List(*sipCpp);
    (*sipRes) += (*a0);
    Py_END_ALLOW_THREADS
%End

Do you need a formal patch please let me know

 ~ Akos.

On Friday 18 March 2005 21:31, Jim Bublitz wrote:
> On Friday 18 March 2005 11:27, Akos Polster wrote:
> > I'm getting this error while compiling PyKDE-snapshot20050316 on
> > Linux with GCC 4.0:
> >
> > sip/kdecore/kurl.sip: In function âPyObject*
> > slot_KURL_List___add__(PyObject*, PyObject*)â:
> > sip/kdecore/kurl.sip:348: error: invalid cast of an rvalue expression of
> > type âQValueList<KURL>â to type âconst KURL::List&â
> >
> > The environment is:
> >
> >  - Python 2.4.0
> >  - sip snapshot-20050317
> >  - QT 3.3.4
> >  - PyQt snapshot-20050311
> >  - KDE 3.4.0
> >  - GCC 4.0.0 20050310 (Red Hat 4.0.0-0.33)
>
> Here's the code in question with the failing line indicated:
>
> sip/kdecore/kurl.sip
> ============
>
>         KURL::List           operator + (const KURL::List&);
> %MethodCode
> //returns (KURL.List)
> //takes listToAdd | (KURL.List)
>     Py_BEGIN_ALLOW_THREADS
> ==>>    sipRes = new KURL::List((const KURL::List&)((*sipCpp) + *a0));
>     Py_END_ALLOW_THREADS
> %End
>
>
> Here's the generated C++ code:
>
> kdecore/sipkdecorepart0.cpp
> ==================
>
> static PyObject *slot_KURL_List___add__(PyObject *sipSelf,PyObject *sipArg)
> {
> ==>> KURL::List *sipCpp = reinterpret_cast<KURL::List *>(sipGetCppPtr(
>                    (sipWrapper *)sipSelf,sipClass_KURL_List));
>
>       if (!sipCpp)
>               return 0;
>
>       int sipArgsParsed = 0;
>
>       {
>               const KURL::List * a0;
>
>               if 
> (sipParseArgs(&sipArgsParsed,sipArg,"J1",sipClass_KURL_List,&a0))
>               {
>                       KURL::List *sipRes = 0;
>
> #line 345 "sip/kdecore/kurl.sip"
> //returns (KURL.List)
> //takes listToAdd | (KURL.List)
>     Py_BEGIN_ALLOW_THREADS
>     sipRes = new KURL::List((const KURL::List&)((*sipCpp) + *a0));
>     Py_END_ALLOW_THREADS
> #line 19720 "sipkdecorepart0.cpp"
>
>                       return
> sipNewCppToSelf(sipRes,sipClass_KURL_List,SIP_SIMPLE|SIP_PY_OWNED); }
>       }
>
>       /* Raise an exception if the arguments couldn't be parsed. */
>       sipNoMethod(sipArgsParsed,sipNm_kdecore_List,sipNm_kdecore___add__);
>
>       return 0;
> }
>
> note that sipCpp is  of type KURL::List.
>
> Here's the class declaration for KURL::List:
>
> kdelibs-3.4.0/kdecore/kurl.h
> ==================
>
> class KURL
> {
>   ...
>   class KDECORE_EXPORT List : public QValueList<KURL>
>
> And from Qt,  the copy constructor being used requires a 'const':
>
>     QValueList ( const QValueList<T> & l )
>
> I don't see where the cast is in error (but then my C++ skills aren't that
> great).
>
> I don't have gcc 4.0 to test against, so I have no way of pursuing this
> much farther. The easiest workaround would be to comment out the code
> fragment shown above from sip/kdecore/kurl.sip (you lose the + operator for
> KURL::List). The cast is there because it won't compile without it on gcc
> 3.3 - it can't find a  "non-const" copy ctor to use, which is what sip
> generates without the cast.
>
> Jim

-- 
Akos Polster
mailto:[EMAIL PROTECTED]
http://akos.pipacs.com

_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to