It is bad practive to throw non-exception objects. That being said, when I run the following code, I would have expected to see the "got it ! " messsage, but do not.
const char* hello = "hello";
try {
throw hello;
}
catch (const char*& e) {
std::cout << "got it ! " << std::endl;
}
catch (...) {
std::cout << "got something..." << std::endl;
}
Removing &
will fix the example, but what is going on here ?
Is this a bug in MSVC ?