Does the standard have anything to say about an exception that is caught by reference and what happens to attempts to modify it?
Consider the following code:
class my_exception: public std::logic_error
{
public:
std::vector<std::string> callstack;
};
void MyFunc()
{
try
{
SomethingThatThrows();
}
catch (my_exception & e)
{
e.callstack.push_back("MyFunc");
throw;
}
}
This is a contrived example, I'm not actually attempting something like this. I was just curious what would happen, based on the suggestion in another thread that exceptions should be caught by const reference.