summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/p8155.C
blob: 79384717cd7556a277a19dd7dcb944e75aaae3a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// { dg-do run  }
// prms-id: 8155

int fail = 1;

class CMainWindow;
class CFrameWnd;
class CWnd;
class CCmdTarget;
 
typedef void (CCmdTarget::*AFX_PMSG)( void);
typedef void (CWnd::*AFX_PMSGW)( void);

struct AFX_MSGMAP_ENTRY {
  unsigned int  nMessage;    
  AFX_PMSG pfn;
};

struct AFX_MSGMAP {
  const AFX_MSGMAP* pBaseMap;
  const AFX_MSGMAP_ENTRY* lpEntries;
};

class CCmdTarget {
public:
  CCmdTarget();
private:
  static AFX_MSGMAP_ENTRY _messageEntries[];
protected:
  static const AFX_MSGMAP messageMap;
  virtual const AFX_MSGMAP* GetMessageMap() const; 
};

const   AFX_MSGMAP CCmdTarget::messageMap = {
  0, &CCmdTarget::_messageEntries[0]
};

const AFX_MSGMAP* CCmdTarget::GetMessageMap() const {
  return &CCmdTarget::messageMap;
}

AFX_MSGMAP_ENTRY CCmdTarget::_messageEntries[] =
{
  { 0, 0 }
};

CCmdTarget :: CCmdTarget() { }
 
class CWnd : public CCmdTarget {
public:
  CWnd();

protected:
  void OnPaint();
private:
  static AFX_MSGMAP_ENTRY _messageEntries[];
protected:
  static   const AFX_MSGMAP messageMap;
  virtual const AFX_MSGMAP* GetMessageMap() const; 
};

CWnd :: CWnd() {
}

void CWnd :: OnPaint() {
}

const AFX_MSGMAP*   CWnd ::GetMessageMap() const {
  return &  CWnd ::messageMap;
}
const AFX_MSGMAP   CWnd ::messageMap = {
  &  CCmdTarget ::messageMap, &  CWnd ::_messageEntries[0]
  };
AFX_MSGMAP_ENTRY   CWnd ::_messageEntries[] = { 
  {0, (AFX_PMSG)0 } }; 

class CFrameWnd : public CWnd {
public:
  CFrameWnd();
protected:
private:
  static AFX_MSGMAP_ENTRY _messageEntries[];
protected:
  static   const AFX_MSGMAP messageMap;
  virtual const AFX_MSGMAP* GetMessageMap() const; 
};

CFrameWnd :: CFrameWnd() { }

const AFX_MSGMAP*   CFrameWnd ::GetMessageMap() const {
  return &  CFrameWnd ::messageMap;
}
const AFX_MSGMAP   CFrameWnd ::messageMap = {
  &  CWnd ::messageMap, &  CFrameWnd ::_messageEntries[0]
  };
AFX_MSGMAP_ENTRY   CFrameWnd ::_messageEntries[] = { 
  {0, (AFX_PMSG)0 } }; 

class CMainWindow : public CFrameWnd {
public:
  CMainWindow();
  void OnPaint();
  void callProc();
private:
  static AFX_MSGMAP_ENTRY _messageEntries[];
protected:
  static   const AFX_MSGMAP messageMap;
  virtual const AFX_MSGMAP* GetMessageMap() const; 
};

CMainWindow :: CMainWindow()
{
}
void CMainWindow :: OnPaint()
{
  fail = 0;
}

void CMainWindow :: callProc()
{
  const AFX_MSGMAP* pMessageMap;
  const AFX_MSGMAP_ENTRY *lpEntry;

  pMessageMap = GetMessageMap();
  lpEntry = pMessageMap->lpEntries;

  if( lpEntry->nMessage == 100) {
    (this->*lpEntry->pfn)();
  }
}

const AFX_MSGMAP*   CMainWindow ::GetMessageMap() const {
  return &  CMainWindow ::messageMap;
}
const AFX_MSGMAP   CMainWindow ::messageMap = {
  &  CFrameWnd ::messageMap, &  CMainWindow ::_messageEntries[0]
  };
AFX_MSGMAP_ENTRY   CMainWindow ::_messageEntries[] = { 
  { 100, (AFX_PMSG)(AFX_PMSGW)(void (CWnd::*)(void))&CMainWindow::OnPaint },
  {0, (AFX_PMSG)0 }
}; 

int main( int argc, char **argv) {
  CMainWindow     myWindow;

  myWindow.callProc();
  return fail;
}