* gdb.cp/mb-inline.exp: Do "info break" after setting multi-location
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / m-static.cc
1 // 2002-05-13
2
3 enum region { oriental, egyptian, greek, etruscan, roman };
4
5 void keepalive(bool *var) { }
6
7 // Test one.
8 class gnu_obj_1
9 {
10 protected:
11 typedef region antiquities;
12 static const bool test = true;
13 static const int key1 = 5;
14 static long key2;
15
16 static antiquities value;
17
18 public:
19 gnu_obj_1(antiquities a, long l) {}
20
21 long method ()
22 {
23 static bool svar = true;
24 keepalive (&svar);
25 return key2;
26 }
27 };
28
29 const bool gnu_obj_1::test;
30 const int gnu_obj_1::key1;
31 long gnu_obj_1::key2 = 77;
32 gnu_obj_1::antiquities gnu_obj_1::value = oriental;
33
34
35 // Test two.
36 template<typename T>
37 class gnu_obj_2: public virtual gnu_obj_1
38 {
39 public:
40 static antiquities value_derived;
41
42 public:
43 gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { }
44 };
45
46 template<typename T>
47 typename gnu_obj_2<T>::antiquities gnu_obj_2<T>::value_derived = etruscan;
48
49 // Test three.
50 template<typename T>
51 class gnu_obj_3
52 {
53 public:
54 typedef region antiquities;
55 static gnu_obj_2<int> data;
56
57 public:
58 gnu_obj_3(antiquities b) { }
59 };
60
61 template<typename T>
62 gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
63
64 // 2002-08-16
65 // Test four.
66 #include "m-static.h"
67
68 // instantiate templates explicitly so their static members will exist
69 template class gnu_obj_2<int>;
70 template class gnu_obj_2<long>;
71 template class gnu_obj_3<long>;
72
73 int main()
74 {
75 gnu_obj_1 test1(egyptian, 4589);
76 gnu_obj_2<long> test2(roman);
77 gnu_obj_3<long> test3(greek);
78 gnu_obj_4 test4;
79
80 test4.dummy = test4.elsewhere;
81 test4.dummy = 0;
82
83 test1.method (); // breakpoint: constructs-done
84
85 return test4.dummy;
86 }
This page took 0.03674 seconds and 4 git commands to generate.