The problem is this line. Since throwthe expression uses the static type of this expression to determine the exception thrown, this cuts the exception object, creating a new object std::exceptionthat copies only part of the base object std::runtime_error, which eis a reference to.
throw e;
catch, throw .
throw;