This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

conversion problem with template, const with gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)


Hi:

I am really puzzled with errors like the following:

g++  -c pymat.cpp -o pymat.o -I/usr/local/matlab6p5/extern/include -I/usr/include/python2.2/numarray -I/usr/include/python2.2 
pymat.cpp: In function `mxArray* makeMxFromNumeric(const PyArrayObject*)':
pymat.cpp:216: invalid conversion from `const maybelong*' to `int*'
pymat.cpp:216:   initializing argument 5 of `void copyNumeric2Mx(T*, int, int, 
   double*, int*) [with T = char]'

where copyNumeric2Mx is a template function:

template <class T>
void copyNumeric2Mx(T *pSrc, int pRows, int pCols, double *pDst, int *pStrides)
{ // ... }

for each instantiated template function like in the following:
  case PyArray_CHAR:
        copyNumeric2Mx((char *)(pSrc->data), lRows, lCols, lR, pSrc->strides);
        break;

    case PyArray_UBYTE:
        copyNumeric2Mx((unsigned char *)(pSrc->data), lRows, lCols, lR, pSrc->strides);
        break;

    case PyArray_SBYTE:
        copyNumeric2Mx((signed char *)(pSrc->data), lRows, lCols, lR, pSrc->strides);
        break;

    case PyArray_SHORT: 
        copyNumeric2Mx((short *)(pSrc->data), lRows, lCols, lR, pSrc->strides);
        break;

Anybody can help me?
Thanks
Roy


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]