>What if you change theClass->constructor to &class_::constructor instead? That didn't work and I got the same error as before, however class_::constructor worked :) Thanks for your help and hints. // Naderan *Mahmood; ----- Original Message ---- From: Jonathan Wakely <jwakely.gcc@xxxxxxxxx> To: Mahmood Naderan <nt_mahmood@xxxxxxxxx> Cc: gcc <gcc-help@xxxxxxxxxxx> Sent: Wed, March 30, 2011 3:42:13 PM Subject: Re: problem porting my application to new gcc (non-const reference ) On 30 March 2011 11:30, Mahmood Naderan wrote: > I rewrte the neccessary funtion definitions again to be clear: ... > static API::conf_object_t * constructor(API::parse_object_t * aParseObject) { OK, this is a static function, that's what I was asking. > template <class CppObjectClass > > class Factory { > typedef Class<CppObjectClass> class_; > class_ * theClass; > public: > Factory() { > static class_ theStaticClass; > theClass = &theStaticClass; > } > typename class_::object_type create(std::string aSimName) { > API::conf_object_t * object = aux_::NewObject_stub( > const_cast<API::conf_class_t *>( theClass->getSimClass() ), aSimName, > theClass->constructor); What if you change theClass->constructor to &class_::constructor instead?