problem porting my application to new gcc (non-const reference )

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
IÂam trying to port my program to new version of gcc. Although it works fine on 
gcc 4.1, I get someÂcompilation errors. For example consider this piece of code:

namespace aux_ {
 API::conf_object_t * NewObject_stub(API::conf_class_t * aClass, std::string 
const & aName, API::conf_object_t * (&constructor)(API::parse_object_t *) );
} //namespace aux_

I get this error:

error: in passing argument 3 of âFlexus::Sim::API::conf_object_t* 
ÂÂ Flexus::Sim::aux_::NewObject_stub(Flexus::Sim::API::conf_class_t*, const 
std::string&, Flexus::Sim::API::conf_object_t* 

ÂÂ (&)(Flexus::Sim::API::parse_object_t*))â


In another part, I have this code:
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);
 
and get this error:

error: invalid initialization of non-const reference of type 
ÂÂ âFlexus::Sim::API::conf_object_t* (&)(Flexus::Sim::API::parse_object_t*)â 
from a temporary of type 

ÂÂ âFlexus::Sim::API::conf_object_t*(Flexus::Sim::API::parse_object_t*)â

I searched for those errors, however I saw some examples about null pointer and 
other thingsÂthat are not related to my code. So I wonder how can I resolve 
that.

Thanks,Â
// Naderan *Mahmood;



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux