Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
NESTED_CLASS_ACCESS.cpp
Go to the documentation of this file.
1// checking member class access
2
3
25struct A
26{
27private:
28 enum { e };
29 static int f (int i) { return i; }
30
31protected:
32 enum { g };
33 static int h (int i) { return i; }
34
35public:
36 struct AA {
37 // check that the compiler implements the resolution of cwg issue 45
38 // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#45
39 static int ag () { return f (e); }
40 static int ah (A a) { return a.f (e); }
41 };
42};
43
44
45struct B: A
46{
47 struct BB {
48 // exercise the same in a derived class
49 static int bg () { return h (0); }
50 static int bh (B b) { return b.h (b.g); }
51 };
52};
53
54
55int foo ()
56{
57 return A::AA::ag () + A::AA::ah (A ()) + B::BB::bg () + B::BB::bh (B ());
58}
#define i
Definition 17.names.cpp:126
#define g
Definition 17.names.cpp:120
#define e
Definition 17.names.cpp:118
#define f
Definition 17.names.cpp:119
#define a
Definition 17.names.cpp:109
#define b
Definition 17.names.cpp:110
int foo()
void BB(B::BB)
Definition NAMESPACE.cpp:43
static int ag()
static int ah(A a)
static int h(int i)
static int bg()
static int bh(B b)