E
Euripides J. Sellountos
Hello kind people.
I hope you can you help me with the following problem.
The following snippet fails to compile with g++.
(It compiles fine with other compilers.)
All I want to do is to throw an "error" exception
when the constructor A::A() gets called. I don't
understand. Do i really have any syntax error?
I'm receiving the following error message
error.cpp: In constructor `A::A()':
error.cpp:11: parse error before `;' token
Administrator@OREMUS
$ cat error.cpp
#include <iostream>
class error {};
class A {
public:
A() throw(error);
};
A::A() throw(error) {
throw(error()); <--- HERE is the syntax error
}
int main () {
try {
A x;
} catch(error a) {
std::cout<<"Ok\n";
}
return 0;
}
Any help is appreciated.
I hope you can you help me with the following problem.
The following snippet fails to compile with g++.
(It compiles fine with other compilers.)
All I want to do is to throw an "error" exception
when the constructor A::A() gets called. I don't
understand. Do i really have any syntax error?
I'm receiving the following error message
error.cpp: In constructor `A::A()':
error.cpp:11: parse error before `;' token
Administrator@OREMUS
$ cat error.cpp
#include <iostream>
class error {};
class A {
public:
A() throw(error);
};
A::A() throw(error) {
throw(error()); <--- HERE is the syntax error
}
int main () {
try {
A x;
} catch(error a) {
std::cout<<"Ok\n";
}
return 0;
}
Any help is appreciated.