F
Fred Zwarts
Consider the following code:
// Start of code
class MyException_t {
public:
// Default constructor.
inline explicit MyException_t () {}
// Initializer constructor.
inline explicit MyException_t (const MyException_t &E) {}
};
int main () { // I know, it needs parameters, that's not my point now.
MyException_t E;
throw E;
}
// End of code
Most compilers have no problem with it, but one compiler shows the following error message:
ppc_60x-g++ -static Except.cpp -o Except
Except.cpp: In function `int main()':
Except.cpp:18: error: no matching function for call to `MyException_t::MyException_t(MyException_t&)'
Except.cpp:18: error: in thrown expression
However, if the "explicit" keywords are remove, it compiles without problem.
Which of the compilers are following the C++ standard?,
The compilers that compile the code with the explicit keyword without error messages,
or the compiler that generates the error messages?
Regards,
Fred.Zwarts.
// Start of code
class MyException_t {
public:
// Default constructor.
inline explicit MyException_t () {}
// Initializer constructor.
inline explicit MyException_t (const MyException_t &E) {}
};
int main () { // I know, it needs parameters, that's not my point now.
MyException_t E;
throw E;
}
// End of code
Most compilers have no problem with it, but one compiler shows the following error message:
ppc_60x-g++ -static Except.cpp -o Except
Except.cpp: In function `int main()':
Except.cpp:18: error: no matching function for call to `MyException_t::MyException_t(MyException_t&)'
Except.cpp:18: error: in thrown expression
However, if the "explicit" keywords are remove, it compiles without problem.
Which of the compilers are following the C++ standard?,
The compilers that compile the code with the explicit keyword without error messages,
or the compiler that generates the error messages?
Regards,
Fred.Zwarts.