Mercurial > hg > CbC > CbC_gcc
view libitm/testsuite/libitm.c++/eh-5.C @ 115:4cb7a319550d
fix c-parser.c
author | mir3636 |
---|---|
date | Tue, 28 Nov 2017 19:31:15 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// Test throwing an exception whose constructor might throw. This tests that // _cxa_free_exception is instrumented. // { dg-do run } // { dg-options "-fgnu-tm" } void __attribute__ ((transaction_pure,noinline)) dontoptimize (int *i) { } struct test { int* data; test (int i) { // new may throw data = new int[1]; data[0] = i; dontoptimize (data); } test (const test& t) : test (t.data[0]) { } ~test () { delete data; } bool operator !=(const test& other) { return data[0] != other.data[0]; } }; int main() { try { atomic_commit { throw test(23); } } catch (test ex) { if (ex.data[0] != 23) __builtin_abort (); } return 0; }