1 /* This test script is part of GDB, the GNU debugger.
4 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 enum region { oriental, egyptian, greek, etruscan, roman };
31 typedef region antiquities;
38 gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {}
43 class gnu_obj_2: public virtual gnu_obj_1
46 antiquities value_derived;
48 gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { }
56 typedef region antiquities;
59 gnu_obj_3(antiquities b): data(etruscan) { }
67 gnu_obj_2<long> test2(roman);
68 gnu_obj_3<long> test3(greek);
74 throw gnu_obj_1(egyptian, 4589); // marker 1-throw
76 catch (gnu_obj_1& obj)
79 if (obj.value != egyptian) // marker 1-catch
93 ++j; // marker 2-start
100 throw gnu_obj_1(egyptian, 4589); // marker 2-throw
102 catch (gnu_obj_1& obj)
105 if (obj.value != egyptian) // marker 2-catch
107 if (obj.key2 != 4589)
111 catch (gnu_obj_1& obj)
114 if (obj.value != egyptian)
116 if (obj.key2 != 4589)
126 // 3 use standard library
131 throw invalid_argument("gdb.1"); // marker 3-throw
133 catch (exception& obj)
135 if (obj.what() != "gdb.1") // marker 3-catch