view gcc/testsuite/g++.old-deja/g++.mike/eh25.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
line wrap: on
line source

// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
// { dg-options "-fexceptions" }

#include <exception>
#include <stdlib.h>

void my_terminate() {
  exit (0);		// Double faults should call terminate
}

struct A {
  A() { }
  ~A()
#if __cplusplus <= 201402L
  throw(int)			// { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
#else
  noexcept(false)
#endif
  {
    std::set_terminate (my_terminate);
    throw 1;		// This throws from EH dtor, should call my_terminate
  }
};

main() {
  try {
    try {
      throw 1;
    } catch (int i) {
      A a;		// A hit on this EH dtor went to the wrong place
      throw 1;
    }
  } catch (...) {
    return 1;
  }
  return 1;
}