OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [testsuite/] [gdb.c++/] [m-static.cc] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
// 2002-05-13
2
 
3
namespace __gnu_test
4
{
5
  enum  region { oriental, egyptian, greek, etruscan, roman };
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
 
22
  const bool gnu_obj_1::test;
23
  const int gnu_obj_1::key1;
24
  long gnu_obj_1::key2 = 77;
25
  gnu_obj_1::antiquities gnu_obj_1::value = oriental;
26
 
27
 
28
  // Test two.
29
  template<typename T>
30
    class gnu_obj_2: public virtual gnu_obj_1
31
    {
32
    public:
33
      static antiquities        value_derived;
34
 
35
    public:
36
      gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { }
37
    };
38
 
39
  template<typename T>
40
    typename gnu_obj_2<T>::antiquities gnu_obj_2<T>::value_derived = etruscan;
41
 
42
  // Test three.
43
  template<typename T>
44
    class gnu_obj_3
45
    {
46
    public:
47
      typedef region antiquities;
48
      static gnu_obj_2<int>     data;
49
 
50
    public:
51
      gnu_obj_3(antiquities b) { }
52
    };
53
 
54
  template<typename T>
55
    gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
56
}
57
 
58
// instantiate templates explicitly so their static members will exist
59
template class __gnu_test::gnu_obj_2<int>;
60
template class __gnu_test::gnu_obj_2<long>;
61
template class __gnu_test::gnu_obj_3<long>;
62
 
63
int main()
64
{
65
  using namespace __gnu_test;
66
 
67
  gnu_obj_1             test1(egyptian, 4589);
68
  gnu_obj_2<long>       test2(roman);
69
  gnu_obj_3<long>       test3(greek);
70
 
71
  return 0;
72
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.