1 /* This test script is part of GDB, the GNU debugger.
3 Copyright 2002-2014 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 enum region { oriental, egyptian, greek, etruscan, roman };
28 typedef region antiquities;
35 gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {}
40 class gnu_obj_2: public virtual gnu_obj_1
43 antiquities value_derived;
45 gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { }
53 typedef region antiquities;
56 gnu_obj_3(antiquities b): data(etruscan) { }
64 gnu_obj_2<long> test2(roman);
65 gnu_obj_3<long> test3(greek);
71 throw gnu_obj_1(egyptian, 4589); // marker 1-throw
73 catch (gnu_obj_1& obj)
76 if (obj.value != egyptian) // marker 1-catch
90 ++j; // marker 2-start
97 throw gnu_obj_1(egyptian, 4589); // marker 2-throw
99 catch (gnu_obj_1& obj)
102 if (obj.value != egyptian) // marker 2-catch
104 if (obj.key2 != 4589)
108 catch (gnu_obj_1& obj)
111 if (obj.value != egyptian)
113 if (obj.key2 != 4589)
123 // 3 use standard library
128 throw invalid_argument("gdb.1"); // marker 3-throw
130 catch (exception& obj)
132 if (obj.what() != "gdb.1") // marker 3-catch