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]

Compilation error while return function pointers


I am getting the Compilation error below which in valid:
error: cannot convert `int (*)(float, float, int)' to `int
(test1::*)(float, float, int)' in return

Can i get rid of this by using cast operators? Please provide some
pointer regarding this.

I am adding the code snippet below as a reference.
================================================================
int test1::member_test1(float a, float b, int c)
{

       return (static_cast<int>(a) + static_cast<int>(b) + c);
}

/* Define a type which is a function pointer for function member_test1 */
typedef int(test1:: *t_member_fptr_test1)(float, float, int);


int func_test2(float a, float b, int c) {

       return (static_cast<int>(a) + static_cast<int>(b) + c);
}


t_member_fptr_test1 func_return_ptr() { return &func_test2;// Error here

}
===============================================================



--
with regards,
purnendu ghosh
-----------------------------------------------------------------------
If you can D.R.E.A.M it you can D.O it
-----------------------------------------------------------------------


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