[Trilinos-Users] Teuchos LAPACK wrapper and ISO C++

Dan Erik Petersen danerik at diku.dk
Tue Mar 18 08:14:55 MDT 2008

Hi everyone,

We're having a bit of trouble with the Teuchos LAPACK wrappers.

We're looking to call the LAPACK function

void Teuchos::LAPACK< OrdinalType, ScalarType >::TREVC( ... )

where OrdinalType = int and ScalarType = double

the problem arises with the third argument to TREVC : OrdinalType(*) 
(ScalarType *, ScalarType *) ptr2func
which we supply with "(int (*)(double*,double*))select"

where select has been initialized to be a vector of integers : int *  

Thus we cast this pointer to an object (int * select) to a pointer to  
a function (int(*)(double*,double*)). The problem is that this is not  
allowed by ISO C++ (we're compiling with -Werror -pedantic), and this  
throws an warning/error. Is there a way around this or an example  
anyone could provide such that we can continue using strict warnings  
on our compiled code?

The warning thrown by compilation is:
warning: ISO C++ forbids casting between pointer-to-function and  



Dan Erik Petersen, Ph.D. Student
Department of Computer Science, University of Copenhagen (DIKU)
Universitetsparken 1, 2100 Copenhagen, Denmark
Phone: +45 35 32 14 00, Fax: +45 35 32 14 01
E-mail: danerik at diku.dk  Home page: www.diku.dk/~danerik

More information about the Trilinos-Users mailing list