1 /* This test script is part of GDB, the GNU debugger.
3 Copyright 2002-2024 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/>. */
23 enum region
{ oriental
, egyptian
, greek
, etruscan
, roman
};
29 typedef region antiquities
;
36 gnu_obj_1(antiquities a
, long l
): test(true), key1(5), key2(l
), value(a
) {}
41 class gnu_obj_2
: public virtual gnu_obj_1
44 antiquities value_derived
;
46 gnu_obj_2(antiquities b
): gnu_obj_1(oriental
, 7), value_derived(b
) { }
54 typedef region antiquities
;
57 gnu_obj_3(antiquities b
): data(etruscan
) { }
65 gnu_obj_2
<long> test2(roman
);
66 gnu_obj_3
<long> test3(greek
);
72 throw gnu_obj_1(egyptian
, 4589); // marker 1-throw
74 catch (gnu_obj_1
& obj
)
77 if (obj
.value
!= egyptian
) // marker 1-catch
91 ++j
; // marker 2-start
98 throw gnu_obj_1(egyptian
, 4589); // marker 2-throw
100 catch (gnu_obj_1
& obj
)
103 if (obj
.value
!= egyptian
) // marker 2-catch
105 if (obj
.key2
!= 4589)
109 catch (gnu_obj_1
& obj
)
112 if (obj
.value
!= egyptian
)
114 if (obj
.key2
!= 4589)
124 // 3 use standard library
129 throw invalid_argument("gdb.1"); // marker 3-throw
131 catch (exception
& obj
)
133 if (strcmp (obj
.what(), "gdb.1") != 0) // marker 3-catch
136 return 0; // marker test-complete