Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
STATIC_CONST_MEMBER_INIT.cpp
Go to the documentation of this file.
1// checking for const member initializer
2
3
25struct A
26{
27 static const int i = 1;
28
29 enum E { e0, e1 };
30
31 static const E e = e0;
32 static const E f = e1;
33};
34
35const int A::i;
36
37const A::E A::e;
38const A::E A::f;
39
40
41enum F { f2 = 2, f3 = 3 };
42
43template <class T>
44struct B
45{
46 static const int i = 2;
47
48 static const F e = f2;
49 static const F f = f3;
50};
51
52template <class T>
53const int B<T>::i;
54
55template <class T>
56const F B<T>::e;
57
58template <class T>
59const F B<T>::f;
60
61
62int main ()
63{
64 int result = 0;
65
66 if (1 != A::i)
67 result = result << 1 + 1;
68
69 if (A::e0 != A::e)
70 result = result << 1 + 1;
71
72 if (A::e1 != A::f)
73 result = result << 1 + 1;
74
75 if (2 != B<int>::i)
76 result = result << 1 + 1;
77
78 if (f2 != B<char>::e)
79 result = result << 1 + 1;
80
81 if (f3 != B<void>::f)
82 result = result << 1 + 1;
83
84 return result;
85}
#define i
Definition 17.names.cpp:126
#define e
Definition 17.names.cpp:118
#define e1
Definition 17.names.cpp:229
#define f
Definition 17.names.cpp:119
#define f2
Definition 17.names.cpp:256
volatile int result