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