xref: /openbsd-src/gnu/usr.bin/gcc/gcc/testsuite/g++.old-deja/g++.mike/p7626.C (revision c87b03e512fc05ed6e0222f6fb0ae86264b1d05b)
1 // Build don't link:
2 // prms-id: 7626
3 
4 int fail;
5 
6 typedef unsigned int UINT;
7 
8 class CObject{};
9 
10 class CCmdTarget : public CObject {
11 };
12 
13 typedef void (CCmdTarget::*AFX_PMSG)(void);
14 
15 struct AFX_MSGMAP_ENTRY {
16   AFX_PMSG pfn;
17 };
18 
19 class CWnd : public CCmdTarget {
20 public:
OnMyMsg()21   void OnMyMsg() { fail  = 1; }		// If this one is called, something is wrong.
22   static AFX_MSGMAP_ENTRY _messageEntries[];
23 };
24 
25 typedef void (CWnd::*AFX_PMSGW)(void);
26 
27 class CDialog : public CWnd
28 {
29 public:
OnMyMsg()30   void OnMyMsg() { }
31   static AFX_MSGMAP_ENTRY _messageEntries[];
32 };
33 
34 AFX_MSGMAP_ENTRY  CDialog ::_messageEntries[] = {
35   { (AFX_PMSG)(AFX_PMSGW)(void (CWnd::*)())&CDialog::OnMyMsg },
36   { (AFX_PMSG)0 }
37 };
38 
main()39 int main() {
40   CDialog d;
41   (d.*((CDialog::_messageEntries)[0]).pfn)();	// This should call CDialog::OnMyMsg
42   return fail;
43 }
44