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 3 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, see <http://www.gnu.org/licenses/>.
24 enum region
{ oriental
, egyptian
, greek
, etruscan
, roman
};
30 typedef region antiquities
;
37 gnu_obj_1(antiquities a
, long l
): test(true), key1(5), key2(l
), value(a
) {}
42 class gnu_obj_2
: public virtual gnu_obj_1
45 antiquities value_derived
;
47 gnu_obj_2(antiquities b
): gnu_obj_1(oriental
, 7), value_derived(b
) { }
55 typedef region antiquities
;
58 gnu_obj_3(antiquities b
): data(etruscan
) { }
66 gnu_obj_2
<long> test2(roman
);
67 gnu_obj_3
<long> test3(greek
);
73 throw gnu_obj_1(egyptian
, 4589); // marker 1-throw
75 catch (gnu_obj_1
& obj
)
78 if (obj
.value
!= egyptian
) // marker 1-catch
92 ++j
; // marker 2-start
99 throw gnu_obj_1(egyptian
, 4589); // marker 2-throw
101 catch (gnu_obj_1
& obj
)
104 if (obj
.value
!= egyptian
) // marker 2-catch
106 if (obj
.key2
!= 4589)
110 catch (gnu_obj_1
& obj
)
113 if (obj
.value
!= egyptian
)
115 if (obj
.key2
!= 4589)
125 // 3 use standard library
130 throw invalid_argument("gdb.1"); // marker 3-throw
132 catch (exception
& obj
)
134 if (obj
.what() != "gdb.1") // marker 3-catch