c++ - GCC problem - invalid conversion from 'void (*)(MyObject*, bool)' to 'const void*' -


i don't want to, have emulate com logic in program , i'm using standard com_addref macros, keep getting following error: invalid conversion 'void ()(myobject, bool)' 'const void*'... should do?

#define com_addref(pobj, pmaster) ((pobj)->addref((pmaster), __file__, __line__, pobj))  class basecomobject { public:     inline dword addref (const void* pmaster, const char* pfilename, int line, const void* pobj) const     {         irefcount++;         return irefcount;     };      inline dword getrefcount() const     {         return irefcount;     };  private:     long irefcount; };  class myobject: public basecomobject { };  void test (myobject* pobject, bool bvalue) {     if (pobject)     {         com_addref (pobject, bvalue);// error: invalid conversion 'void (*)(myobject*, bool)' 'const void*'     } } 

error: invalid conversion 'void ()(myobject, bool)' 'const void*'

error: initializing argument 1 of 'dword basecomobject::addref(const void*, const char*, int, const void*) const'

it doesn't me code that's generating error. when compile g++ (fixing obvious errors dword , modifying class state in const function, tells me can't find matching function.

the gist you're passing bool second argument com_addref , base class addref function wants void* in parameter position. highly suspect have class implicit bool constructor aren't showing us, , that's confusing compiler.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -