From this answer https://stackoverflow.com/a/36738405/4523099 :
A throw-expression with no operand rethrows the currently handled exception. The exception is reactivated with the existing temporary; no new temporary exception object is created. -- ISO/IEC 14882:2011 Section 15.1 par. 8
So why I am getting this results from this code?
code:
#include <iostream>
class my_exception: public std::exception{
public:
int value;
};
int main()
{
my_exception ex;
ex.value=1;
try{
throw ex;
}
catch(my_exception& e){
e.value=2;
}
std::cout << ex.value;
return 0;
}
Actual result:
1
I thought it should be 2 depending on the standard quota. What am I missing?