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]

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


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]