fork download
  1. #include <iostream>
  2. #include <stdexcept>
  3.  
  4. using namespace std;
  5.  
  6. struct my_exception : public std::exception {
  7. using std::exception::exception;
  8. };
  9.  
  10. int main() {
  11. try {
  12. throw my_exception{};
  13. } catch (const my_exception& e) {
  14. cout << "my_exception" << endl;
  15. } catch (const std::exception& e) {
  16. cout << "std::exception" << endl;
  17. }
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 4520KB
stdin
Standard input is empty
stdout
my_exception