]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc
96d38d5eba3edf76c9ae50e0f155444002507ac3
1 // { dg-options "-std=gnu++0x" }
2 // 2008-05-25 Sebastian Redl <sebastian.redl@getdesigned.at>
4 // Copyright (C) 2008 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 // rethrow_exception() and preservation of data
28 #include <testsuite_hooks.h>
32 bool test
__attribute__((unused
)) = true;
36 rethrow_exception(copy_exception(0));
43 bool test
__attribute__((unused
)) = true;
47 rethrow_exception(copy_exception(runtime_error("test")));
48 } catch(exception
&e
) {
49 VERIFY( typeid(e
) == typeid(runtime_error
) );
50 VERIFY( strcmp(e
.what(), "test") == 0 );
56 bool test
__attribute__((unused
)) = true;
63 ep
= current_exception();
66 rethrow_exception(ep
);
73 bool test
__attribute__((unused
)) = true;
76 // Weave the exceptions in an attempt to confuse the machinery.
80 exception_ptr ep1
= current_exception();
84 exception_ptr ep2
= current_exception();
86 rethrow_exception(ep1
);
89 rethrow_exception(ep2
);
92 rethrow_exception(ep1
);
96 rethrow_exception(ep2
);