xref: /llvm-project/clang/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp (revision 12f78e740c5419f7d1fbcf8f2106e7a40cd1d6f7)
1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple i386-apple-macosx10.7.2
2 // PR1084
3 
4 extern "C"
5 {
6   typedef unsigned char PRUint8;
7   typedef unsigned int PRUint32;
8 }
9 typedef PRUint32 nsresult;
10 struct nsID
11 {
12 };
13 typedef nsID nsIID;
14 class nsISupports
15 {
16 };
17 extern "C++"
18 {
19   template < class T > struct nsCOMTypeInfo
20   {
21     static const nsIID & GetIID ()
22     {
23       static const nsIID i = {};
24       return i;
25     }
26   };
27 }
28 
29 class nsIDOMEvent:public nsISupports
30 {
31 };
32 class nsIDOMEventListener:public nsISupports
33 {
34 public:static const nsIID & GetIID ()
35   {
36     static const nsIID i = {};
37     return i;
38   }
39   virtual nsresult
40     __attribute__ ((regparm (0), cdecl)) HandleEvent (nsIDOMEvent * event) =
41     0;
42 };
43 class nsIDOMMouseListener:public nsIDOMEventListener
44 {
45 public:static const nsIID & GetIID ()
46   {
47     static const nsIID iid = {
48     };
49     return iid;
50   }
51   virtual nsresult
52     __attribute__ ((regparm (0),
53 		    cdecl)) MouseDown (nsIDOMEvent * aMouseEvent) = 0;
54 };
55 typedef
56 typeof (&nsIDOMEventListener::HandleEvent)
57   GenericHandler;
58      struct EventDispatchData
59      {
60        PRUint32 message;
61        GenericHandler method;
62        PRUint8 bits;
63      };
64      struct EventTypeData
65      {
66        const EventDispatchData *events;
67        int numEvents;
68        const nsIID *iid;
69      };
70      static const EventDispatchData sMouseEvents[] = {
71        {
72 	(300 + 2),
73 	reinterpret_cast < GenericHandler > (&nsIDOMMouseListener::MouseDown),
74 	0x01}
75      };
76 static const EventTypeData sEventTypes[] = {
77   {
78    sMouseEvents, (sizeof (sMouseEvents) / sizeof (sMouseEvents[0])),
79    &nsCOMTypeInfo < nsIDOMMouseListener >::GetIID ()}
80 };
81