compiler confusion?

Ivan Molella i.molella@reply.it
Wed Apr 23 15:46:00 GMT 2003


I' have the follwing problem:


I' have the following assertion class:

template<class Excp>
class Assert
{
public:

typedef Excp exception_throwed;

Assert(bool val, const char* msg_throwed, long code)
: value(val), message(msg_throwed), excCode(code)
{ }

Assert(bool val, string msg_throwed, long code)
: value(val), message(msg_throwed), excCode(code)
{ }

void do_assert()
{
if (!(value)) throw exception_throwed(message, excCode);
}


private:

bool value;
const string message;
long excCode;
};

when i use this assertion in the following code:

void
telnetClient::init(const string pTelnetProg,char* const* pArgs,char* 
const*pEnv,int _timeout) {
.....
31> Assert<telnetClientException>((checkProcessStatus() == 
telnetClient::process_running),"[MM CO=EBEX_TELNET_L0016 
MM]",PROCESS_DOWN_ERROR).do_assert();
....

}

i have the following error:

telnetClient.cpp: In member function `void
telnetClient::init(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, char* const*, char* const*, int)':
telnetClient.cpp:31: parse error before `==' token


while if i do:

void
telnetClient::init(const string pTelnetProg,char* const* pArgs,char* 
const*pEnv,int _timeout) {
.....
31> Assert<telnetClientException>((this->checkProcessStatus() == 
telnetClient::process_running),"[MM CO=EBEX_TELNET_L0016 
MM]",PROCESS_DOWN_ERROR).do_assert();
....

}


compilation is done without any error.

I'm using gcc 3.2.

What's the matter with the first expression?


Thanks in advance.

Ivan




checkProcessStatus is so defined:

bool
telnetClient::checkProcessStatus()
{
if (task.isAlive()==telnetClient::process_terminated){
return telnetClient::process_terminated;
}

return telnetClient::process_running;
}



More information about the Gcc mailing list