1c2c66affSColin Finck /* Unit test suite for msvcrt C++ objects
2c2c66affSColin Finck *
3c2c66affSColin Finck * Copyright 2003 Jon Griffiths
4c2c66affSColin Finck *
5c2c66affSColin Finck * This library is free software; you can redistribute it and/or
6c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
7c2c66affSColin Finck * License as published by the Free Software Foundation; either
8c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
9c2c66affSColin Finck *
10c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
11c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
12c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13c2c66affSColin Finck * Lesser General Public License for more details.
14c2c66affSColin Finck *
15c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
16c2c66affSColin Finck * License along with this library; if not, write to the Free Software
17c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18c2c66affSColin Finck */
191c9ac7a2SAmine Khaldi #include "wine/test.h"
201c9ac7a2SAmine Khaldi #include "winbase.h"
211c9ac7a2SAmine Khaldi #include "winnt.h"
22c2c66affSColin Finck
23c2c66affSColin Finck typedef void (*vtable_ptr)(void);
24c2c66affSColin Finck
25c2c66affSColin Finck typedef struct __exception
26c2c66affSColin Finck {
27c2c66affSColin Finck vtable_ptr *vtable;
28c2c66affSColin Finck char *name;
29c2c66affSColin Finck int do_free;
30c2c66affSColin Finck } exception;
31c2c66affSColin Finck
32c2c66affSColin Finck typedef struct __type_info
33c2c66affSColin Finck {
34c2c66affSColin Finck vtable_ptr *vtable;
35c2c66affSColin Finck char *name;
36c2c66affSColin Finck char mangled[16];
37c2c66affSColin Finck } type_info;
38c2c66affSColin Finck
39c2c66affSColin Finck #undef __thiscall
40c2c66affSColin Finck #ifdef __i386__
41c2c66affSColin Finck #define __thiscall __stdcall
42c2c66affSColin Finck #else
43c2c66affSColin Finck #define __thiscall __cdecl
44c2c66affSColin Finck #endif
45c2c66affSColin Finck
46c2c66affSColin Finck /* Function pointers. We need to use these to call these funcs as __thiscall */
47c2c66affSColin Finck static HMODULE hMsvcrt;
48c2c66affSColin Finck
49c2c66affSColin Finck static void* (__cdecl *poperator_new)(unsigned int);
50c2c66affSColin Finck static void (__cdecl *poperator_delete)(void*);
51c2c66affSColin Finck static void* (__cdecl *pmalloc)(unsigned int);
52c2c66affSColin Finck static void (__cdecl *pfree)(void*);
53c2c66affSColin Finck
54c2c66affSColin Finck /* exception */
55c2c66affSColin Finck static void (__thiscall *pexception_ctor)(exception*,LPCSTR*);
56c2c66affSColin Finck static void (__thiscall *pexception_copy_ctor)(exception*,exception*);
57c2c66affSColin Finck static void (__thiscall *pexception_default_ctor)(exception*);
58c2c66affSColin Finck static void (__thiscall *pexception_dtor)(exception*);
59c2c66affSColin Finck static exception* (__thiscall *pexception_opequals)(exception*,exception*);
60c2c66affSColin Finck static char* (__thiscall *pexception_what)(exception*);
61c2c66affSColin Finck static vtable_ptr *pexception_vtable;
62c2c66affSColin Finck static void (__thiscall *pexception_vector_dtor)(exception*,unsigned int);
63c2c66affSColin Finck static void (__thiscall *pexception_scalar_dtor)(exception*,unsigned int);
64c2c66affSColin Finck
65c2c66affSColin Finck /* bad_typeid */
66c2c66affSColin Finck static void (__thiscall *pbad_typeid_ctor)(exception*,LPCSTR);
67c2c66affSColin Finck static void (__thiscall *pbad_typeid_ctor_closure)(exception*);
68c2c66affSColin Finck static void (__thiscall *pbad_typeid_copy_ctor)(exception*,exception*);
69c2c66affSColin Finck static void (__thiscall *pbad_typeid_dtor)(exception*);
70c2c66affSColin Finck static exception* (__thiscall *pbad_typeid_opequals)(exception*,exception*);
71c2c66affSColin Finck static char* (__thiscall *pbad_typeid_what)(exception*);
72c2c66affSColin Finck static vtable_ptr *pbad_typeid_vtable;
73c2c66affSColin Finck static void (__thiscall *pbad_typeid_vector_dtor)(exception*,unsigned int);
74c2c66affSColin Finck static void (__thiscall *pbad_typeid_scalar_dtor)(exception*,unsigned int);
75c2c66affSColin Finck
76c2c66affSColin Finck /* bad_cast */
77c2c66affSColin Finck static void (__thiscall *pbad_cast_ctor)(exception*,LPCSTR*);
78c2c66affSColin Finck static void (__thiscall *pbad_cast_ctor2)(exception*,LPCSTR);
79c2c66affSColin Finck static void (__thiscall *pbad_cast_ctor_closure)(exception*);
80c2c66affSColin Finck static void (__thiscall *pbad_cast_copy_ctor)(exception*,exception*);
81c2c66affSColin Finck static void (__thiscall *pbad_cast_dtor)(exception*);
82c2c66affSColin Finck static exception* (__thiscall *pbad_cast_opequals)(exception*,exception*);
83c2c66affSColin Finck static char* (__thiscall *pbad_cast_what)(exception*);
84c2c66affSColin Finck static vtable_ptr *pbad_cast_vtable;
85c2c66affSColin Finck static void (__thiscall *pbad_cast_vector_dtor)(exception*,unsigned int);
86c2c66affSColin Finck static void (__thiscall *pbad_cast_scalar_dtor)(exception*,unsigned int);
87c2c66affSColin Finck
88c2c66affSColin Finck /* __non_rtti_object */
89c2c66affSColin Finck static void (__thiscall *p__non_rtti_object_ctor)(exception*,LPCSTR);
90c2c66affSColin Finck static void (__thiscall *p__non_rtti_object_copy_ctor)(exception*,exception*);
91c2c66affSColin Finck static void (__thiscall *p__non_rtti_object_dtor)(exception*);
92c2c66affSColin Finck static exception* (__thiscall *p__non_rtti_object_opequals)(exception*,exception*);
93c2c66affSColin Finck static char* (__thiscall *p__non_rtti_object_what)(exception*);
94c2c66affSColin Finck static vtable_ptr *p__non_rtti_object_vtable;
95c2c66affSColin Finck static void (__thiscall *p__non_rtti_object_vector_dtor)(exception*,unsigned int);
96c2c66affSColin Finck static void (__thiscall *p__non_rtti_object_scalar_dtor)(exception*,unsigned int);
97c2c66affSColin Finck
98c2c66affSColin Finck /* type_info */
99c2c66affSColin Finck static void (__thiscall *ptype_info_dtor)(type_info*);
100c2c66affSColin Finck static char* (__thiscall *ptype_info_raw_name)(type_info*);
101c2c66affSColin Finck static char* (__thiscall *ptype_info_name)(type_info*);
102c2c66affSColin Finck static int (__thiscall *ptype_info_before)(type_info*,type_info*);
103c2c66affSColin Finck static int (__thiscall *ptype_info_opequals_equals)(type_info*,type_info*);
104c2c66affSColin Finck static int (__thiscall *ptype_info_opnot_equals)(type_info*,type_info*);
105c2c66affSColin Finck
106c2c66affSColin Finck /* RTTI */
107c2c66affSColin Finck static type_info* (__cdecl *p__RTtypeid)(void*);
108c2c66affSColin Finck static void* (__cdecl *p__RTCastToVoid)(void*);
109c2c66affSColin Finck static void* (__cdecl *p__RTDynamicCast)(void*,int,void*,void*,int);
110c2c66affSColin Finck
111c2c66affSColin Finck /*Demangle*/
112c2c66affSColin Finck static char* (__cdecl *p__unDName)(char*,const char*,int,void*,void*,unsigned short int);
113c2c66affSColin Finck
114c2c66affSColin Finck
115c2c66affSColin Finck /* _very_ early native versions have serious RTTI bugs, so we check */
116c2c66affSColin Finck static void* bAncientVersion;
117c2c66affSColin Finck
118c2c66affSColin Finck /* Emulate a __thiscall */
119c2c66affSColin Finck #ifdef __i386__
120c2c66affSColin Finck
121c2c66affSColin Finck #include "pshpack1.h"
122c2c66affSColin Finck struct thiscall_thunk
123c2c66affSColin Finck {
124c2c66affSColin Finck BYTE pop_eax; /* popl %eax (ret addr) */
125c2c66affSColin Finck BYTE pop_edx; /* popl %edx (func) */
126c2c66affSColin Finck BYTE pop_ecx; /* popl %ecx (this) */
127c2c66affSColin Finck BYTE push_eax; /* pushl %eax */
128c2c66affSColin Finck WORD jmp_edx; /* jmp *%edx */
129c2c66affSColin Finck };
130c2c66affSColin Finck #include "poppack.h"
131c2c66affSColin Finck
132c2c66affSColin Finck static void * (WINAPI *call_thiscall_func1)( void *func, void *this );
133c2c66affSColin Finck static void * (WINAPI *call_thiscall_func2)( void *func, void *this, const void *a );
134c2c66affSColin Finck
init_thiscall_thunk(void)135c2c66affSColin Finck static void init_thiscall_thunk(void)
136c2c66affSColin Finck {
137c2c66affSColin Finck struct thiscall_thunk *thunk = VirtualAlloc( NULL, sizeof(*thunk),
138c2c66affSColin Finck MEM_COMMIT, PAGE_EXECUTE_READWRITE );
139c2c66affSColin Finck thunk->pop_eax = 0x58; /* popl %eax */
140c2c66affSColin Finck thunk->pop_edx = 0x5a; /* popl %edx */
141c2c66affSColin Finck thunk->pop_ecx = 0x59; /* popl %ecx */
142c2c66affSColin Finck thunk->push_eax = 0x50; /* pushl %eax */
143c2c66affSColin Finck thunk->jmp_edx = 0xe2ff; /* jmp *%edx */
144c2c66affSColin Finck call_thiscall_func1 = (void *)thunk;
145c2c66affSColin Finck call_thiscall_func2 = (void *)thunk;
146c2c66affSColin Finck }
147c2c66affSColin Finck
148c2c66affSColin Finck #define call_func1(func,_this) call_thiscall_func1(func,_this)
149c2c66affSColin Finck #define call_func2(func,_this,a) call_thiscall_func2(func,_this,(const void*)(a))
150c2c66affSColin Finck
151c2c66affSColin Finck #else
152c2c66affSColin Finck
153c2c66affSColin Finck #define init_thiscall_thunk() do { } while(0)
154c2c66affSColin Finck #define call_func1(func,_this) func(_this)
155c2c66affSColin Finck #define call_func2(func,_this,a) func(_this,a)
156c2c66affSColin Finck
157c2c66affSColin Finck #endif /* __i386__ */
158c2c66affSColin Finck
159c2c66affSColin Finck /* Some exports are only available in later versions */
160c2c66affSColin Finck #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
161c2c66affSColin Finck #define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
162c2c66affSColin Finck
InitFunctionPtrs(void)163c2c66affSColin Finck static BOOL InitFunctionPtrs(void)
164c2c66affSColin Finck {
165c2c66affSColin Finck hMsvcrt = GetModuleHandleA("msvcrt.dll");
166c2c66affSColin Finck if (!hMsvcrt)
167c2c66affSColin Finck hMsvcrt = GetModuleHandleA("msvcrtd.dll");
168c2c66affSColin Finck ok(hMsvcrt != 0, "GetModuleHandleA failed\n");
169c2c66affSColin Finck if (!hMsvcrt)
170c2c66affSColin Finck {
171c2c66affSColin Finck win_skip("Could not load msvcrt.dll\n");
172c2c66affSColin Finck return FALSE;
173c2c66affSColin Finck }
174c2c66affSColin Finck
175c2c66affSColin Finck SET(pmalloc, "malloc");
176c2c66affSColin Finck SET(pfree, "free");
177c2c66affSColin Finck
178c2c66affSColin Finck SET(pexception_vtable, "??_7exception@@6B@");
179c2c66affSColin Finck SET(pbad_typeid_vtable, "??_7bad_typeid@@6B@");
180c2c66affSColin Finck SET(pbad_cast_vtable, "??_7bad_cast@@6B@");
181c2c66affSColin Finck SET(p__non_rtti_object_vtable, "??_7__non_rtti_object@@6B@");
182c2c66affSColin Finck
183c2c66affSColin Finck SET(p__RTtypeid, "__RTtypeid");
184c2c66affSColin Finck SET(p__RTCastToVoid, "__RTCastToVoid");
185c2c66affSColin Finck SET(p__RTDynamicCast, "__RTDynamicCast");
186c2c66affSColin Finck
187c2c66affSColin Finck SET(p__unDName,"__unDName");
188c2c66affSColin Finck
189c2c66affSColin Finck /* Extremely early versions export logic_error, and crash in RTTI */
190c2c66affSColin Finck SETNOFAIL(bAncientVersion, "??0logic_error@@QAE@ABQBD@Z");
191c2c66affSColin Finck if (sizeof(void *) > sizeof(int)) /* 64-bit initialization */
192c2c66affSColin Finck {
193c2c66affSColin Finck SETNOFAIL(poperator_new, "??_U@YAPEAX_K@Z");
194c2c66affSColin Finck SETNOFAIL(poperator_delete, "??_V@YAXPEAX@Z");
195c2c66affSColin Finck
196c2c66affSColin Finck SET(pexception_ctor, "??0exception@@QEAA@AEBQEBD@Z");
197c2c66affSColin Finck SET(pexception_copy_ctor, "??0exception@@QEAA@AEBV0@@Z");
198c2c66affSColin Finck SET(pexception_default_ctor, "??0exception@@QEAA@XZ");
199c2c66affSColin Finck SET(pexception_dtor, "??1exception@@UEAA@XZ");
200c2c66affSColin Finck SET(pexception_opequals, "??4exception@@QEAAAEAV0@AEBV0@@Z");
201c2c66affSColin Finck SET(pexception_what, "?what@exception@@UEBAPEBDXZ");
202c2c66affSColin Finck pexception_vector_dtor = (void*)pexception_vtable[0];
203c2c66affSColin Finck pexception_scalar_dtor = (void*)pexception_vtable[0];
204c2c66affSColin Finck
205c2c66affSColin Finck SET(pbad_typeid_ctor, "??0bad_typeid@@QEAA@PEBD@Z");
206c2c66affSColin Finck SETNOFAIL(pbad_typeid_ctor_closure, "??_Fbad_typeid@@QEAAXXZ");
207c2c66affSColin Finck SET(pbad_typeid_copy_ctor, "??0bad_typeid@@QEAA@AEBV0@@Z");
208c2c66affSColin Finck SET(pbad_typeid_dtor, "??1bad_typeid@@UEAA@XZ");
209c2c66affSColin Finck SET(pbad_typeid_opequals, "??4bad_typeid@@QEAAAEAV0@AEBV0@@Z");
210c2c66affSColin Finck SET(pbad_typeid_what, "?what@exception@@UEBAPEBDXZ");
211c2c66affSColin Finck pbad_typeid_vector_dtor = (void*)pbad_typeid_vtable[0];
212c2c66affSColin Finck pbad_typeid_scalar_dtor = (void*)pbad_typeid_vtable[0];
213c2c66affSColin Finck
214c2c66affSColin Finck SET(pbad_cast_ctor, "??0bad_cast@@QEAA@AEBQEBD@Z");
215c2c66affSColin Finck SET(pbad_cast_ctor2, "??0bad_cast@@QEAA@PEBD@Z");
216c2c66affSColin Finck SET(pbad_cast_ctor_closure, "??_Fbad_cast@@QEAAXXZ");
217c2c66affSColin Finck SET(pbad_cast_copy_ctor, "??0bad_cast@@QEAA@AEBV0@@Z");
218c2c66affSColin Finck SET(pbad_cast_dtor, "??1bad_cast@@UEAA@XZ");
219c2c66affSColin Finck SET(pbad_cast_opequals, "??4bad_cast@@QEAAAEAV0@AEBV0@@Z");
220c2c66affSColin Finck SET(pbad_cast_what, "?what@exception@@UEBAPEBDXZ");
221c2c66affSColin Finck pbad_cast_vector_dtor = (void*)pbad_cast_vtable[0];
222c2c66affSColin Finck pbad_cast_scalar_dtor = (void*)pbad_cast_vtable[0];
223c2c66affSColin Finck
224c2c66affSColin Finck SET(p__non_rtti_object_ctor, "??0__non_rtti_object@@QEAA@PEBD@Z");
225c2c66affSColin Finck SET(p__non_rtti_object_copy_ctor, "??0__non_rtti_object@@QEAA@AEBV0@@Z");
226c2c66affSColin Finck SET(p__non_rtti_object_dtor, "??1__non_rtti_object@@UEAA@XZ");
227c2c66affSColin Finck SET(p__non_rtti_object_opequals, "??4__non_rtti_object@@QEAAAEAV0@AEBV0@@Z");
228c2c66affSColin Finck SET(p__non_rtti_object_what, "?what@exception@@UEBAPEBDXZ");
229c2c66affSColin Finck p__non_rtti_object_vector_dtor = (void*)p__non_rtti_object_vtable[0];
230c2c66affSColin Finck p__non_rtti_object_scalar_dtor = (void*)p__non_rtti_object_vtable[0];
231c2c66affSColin Finck
232c2c66affSColin Finck SET(ptype_info_dtor, "??1type_info@@UEAA@XZ");
233c2c66affSColin Finck SET(ptype_info_raw_name, "?raw_name@type_info@@QEBAPEBDXZ");
234c2c66affSColin Finck SET(ptype_info_name, "?name@type_info@@QEBAPEBDXZ");
235c2c66affSColin Finck SET(ptype_info_before, "?before@type_info@@QEBAHAEBV1@@Z");
236c2c66affSColin Finck SET(ptype_info_opequals_equals, "??8type_info@@QEBAHAEBV0@@Z");
237c2c66affSColin Finck SET(ptype_info_opnot_equals, "??9type_info@@QEBAHAEBV0@@Z");
238c2c66affSColin Finck }
239c2c66affSColin Finck else
240c2c66affSColin Finck {
241c2c66affSColin Finck #ifdef __arm__
242c2c66affSColin Finck SETNOFAIL(poperator_new, "??_U@YAPAXI@Z");
243c2c66affSColin Finck SETNOFAIL(poperator_delete, "??_V@YAXPAX@Z");
244c2c66affSColin Finck
245c2c66affSColin Finck SET(pexception_ctor, "??0exception@std@@QAA@ABQBD@Z");
246c2c66affSColin Finck SET(pexception_copy_ctor, "??0exception@std@@QAA@ABV01@@Z");
247c2c66affSColin Finck SET(pexception_default_ctor, "??0exception@std@@QAA@XZ");
248c2c66affSColin Finck SET(pexception_dtor, "??1exception@std@@UAA@XZ");
249c2c66affSColin Finck SET(pexception_opequals, "??4exception@std@@QAAAAV01@ABV01@@Z");
250c2c66affSColin Finck SET(pexception_what, "?what@exception@std@@UBAPBDXZ");
251c2c66affSColin Finck SET(pexception_vector_dtor, "??_Eexception@@UAEPAXI@Z");/**/
252c2c66affSColin Finck SET(pexception_scalar_dtor, "??_Gexception@@UAEPAXI@Z");/**/
253c2c66affSColin Finck
254c2c66affSColin Finck SET(pbad_typeid_ctor, "??0bad_typeid@std@@QAA@PBD@Z");
255c2c66affSColin Finck SETNOFAIL(pbad_typeid_ctor_closure, "??_Fbad_typeid@std@@QAAXXZ");
256c2c66affSColin Finck SET(pbad_typeid_copy_ctor, "??0bad_typeid@std@@QAA@ABV01@@Z");
257c2c66affSColin Finck SET(pbad_typeid_dtor, "??1bad_typeid@std@@UAA@XZ");
258c2c66affSColin Finck SET(pbad_typeid_opequals, "??4bad_typeid@std@@QAAAAV01@ABV01@@Z");
259c2c66affSColin Finck SET(pbad_typeid_what, "?what@exception@std@@UBAPBDXZ");
260c2c66affSColin Finck SET(pbad_typeid_vector_dtor, "??_Ebad_cast@@UAEPAXI@Z");
261c2c66affSColin Finck SET(pbad_typeid_scalar_dtor, "??_Gbad_cast@@UAEPAXI@Z");
262c2c66affSColin Finck
263c2c66affSColin Finck SETNOFAIL(pbad_cast_ctor, "??0bad_cast@@QAE@ABQBD@Z");
264c2c66affSColin Finck if (!pbad_cast_ctor)
265c2c66affSColin Finck SET(pbad_cast_ctor, "??0bad_cast@std@@AAA@PBQBD@Z");
266c2c66affSColin Finck SETNOFAIL(pbad_cast_ctor2, "??0bad_cast@std@@QAA@PBD@Z");
267c2c66affSColin Finck SETNOFAIL(pbad_cast_ctor_closure, "??_Fbad_cast@std@@QAAXXZ");
268c2c66affSColin Finck /* FIXME: No ARM equivalent for "??0bad_cast@@QAE@ABV0@@Z" */
269c2c66affSColin Finck SET(pbad_cast_dtor, "??1bad_cast@std@@UAA@XZ");
270c2c66affSColin Finck SET(pbad_cast_opequals, "??4bad_cast@std@@QAAAAV01@ABV01@@Z");
271c2c66affSColin Finck SET(pbad_cast_what, "?what@exception@std@@UBAPBDXZ");
272c2c66affSColin Finck SET(pbad_cast_vector_dtor, "??_Ebad_cast@@UAEPAXI@Z");
273c2c66affSColin Finck SET(pbad_cast_scalar_dtor, "??_Gbad_cast@@UAEPAXI@Z");
274c2c66affSColin Finck
275c2c66affSColin Finck SET(p__non_rtti_object_ctor, "??0__non_rtti_object@std@@QAA@PBD@Z");
276c2c66affSColin Finck SET(p__non_rtti_object_copy_ctor, "??0__non_rtti_object@std@@QAA@ABV01@@Z");
277c2c66affSColin Finck SET(p__non_rtti_object_dtor, "??1__non_rtti_object@std@@UAA@XZ");
278c2c66affSColin Finck SET(p__non_rtti_object_opequals, "??4__non_rtti_object@std@@QAAAAV01@ABV01@@Z");
279c2c66affSColin Finck SET(p__non_rtti_object_what, "?what@exception@std@@UBAPBDXZ");
280c2c66affSColin Finck SET(p__non_rtti_object_vector_dtor, "??_E__non_rtti_object@@UAEPAXI@Z");
281c2c66affSColin Finck SET(p__non_rtti_object_scalar_dtor, "??_G__non_rtti_object@@UAEPAXI@Z");
282c2c66affSColin Finck
283c2c66affSColin Finck SET(ptype_info_dtor, "??1type_info@@UAA@XZ");
284c2c66affSColin Finck SET(ptype_info_raw_name, "?raw_name@type_info@@QBAPBDXZ");
285c2c66affSColin Finck SET(ptype_info_name, "?name@type_info@@QBEPBDXZ");
286c2c66affSColin Finck SET(ptype_info_before, "?before@type_info@@QBA_NABV1@@Z");
287c2c66affSColin Finck SET(ptype_info_opequals_equals, "??8type_info@@QBA_NABV0@@Z");
288c2c66affSColin Finck SET(ptype_info_opnot_equals, "??9type_info@@QBA_NABV0@@Z");
289c2c66affSColin Finck #else
290c2c66affSColin Finck SETNOFAIL(poperator_new, "??_U@YAPAXI@Z");
291c2c66affSColin Finck SETNOFAIL(poperator_delete, "??_V@YAXPAX@Z");
292c2c66affSColin Finck
293c2c66affSColin Finck SET(pexception_ctor, "??0exception@@QAE@ABQBD@Z");
294c2c66affSColin Finck SET(pexception_copy_ctor, "??0exception@@QAE@ABV0@@Z");
295c2c66affSColin Finck SET(pexception_default_ctor, "??0exception@@QAE@XZ");
296c2c66affSColin Finck SET(pexception_dtor, "??1exception@@UAE@XZ");
297c2c66affSColin Finck SET(pexception_opequals, "??4exception@@QAEAAV0@ABV0@@Z");
298c2c66affSColin Finck SET(pexception_what, "?what@exception@@UBEPBDXZ");
299c2c66affSColin Finck SET(pexception_vector_dtor, "??_Eexception@@UAEPAXI@Z");
300c2c66affSColin Finck SET(pexception_scalar_dtor, "??_Gexception@@UAEPAXI@Z");
301c2c66affSColin Finck
302c2c66affSColin Finck SET(pbad_typeid_ctor, "??0bad_typeid@@QAE@PBD@Z");
303c2c66affSColin Finck SETNOFAIL(pbad_typeid_ctor_closure, "??_Fbad_typeid@@QAEXXZ");
304c2c66affSColin Finck SET(pbad_typeid_copy_ctor, "??0bad_typeid@@QAE@ABV0@@Z");
305c2c66affSColin Finck SET(pbad_typeid_dtor, "??1bad_typeid@@UAE@XZ");
306c2c66affSColin Finck SET(pbad_typeid_opequals, "??4bad_typeid@@QAEAAV0@ABV0@@Z");
307c2c66affSColin Finck SET(pbad_typeid_what, "?what@exception@@UBEPBDXZ");
308c2c66affSColin Finck SET(pbad_typeid_vector_dtor, "??_Ebad_typeid@@UAEPAXI@Z");
309c2c66affSColin Finck SET(pbad_typeid_scalar_dtor, "??_Gbad_typeid@@UAEPAXI@Z");
310c2c66affSColin Finck
311c2c66affSColin Finck SETNOFAIL(pbad_cast_ctor, "??0bad_cast@@QAE@ABQBD@Z");
312c2c66affSColin Finck if (!pbad_cast_ctor)
313c2c66affSColin Finck SET(pbad_cast_ctor, "??0bad_cast@@AAE@PBQBD@Z");
314c2c66affSColin Finck SETNOFAIL(pbad_cast_ctor2, "??0bad_cast@@QAE@PBD@Z");
315c2c66affSColin Finck SETNOFAIL(pbad_cast_ctor_closure, "??_Fbad_cast@@QAEXXZ");
316c2c66affSColin Finck SET(pbad_cast_copy_ctor, "??0bad_cast@@QAE@ABV0@@Z");
317c2c66affSColin Finck SET(pbad_cast_dtor, "??1bad_cast@@UAE@XZ");
318c2c66affSColin Finck SET(pbad_cast_opequals, "??4bad_cast@@QAEAAV0@ABV0@@Z");
319c2c66affSColin Finck SET(pbad_cast_what, "?what@exception@@UBEPBDXZ");
320c2c66affSColin Finck SET(pbad_cast_vector_dtor, "??_Ebad_cast@@UAEPAXI@Z");
321c2c66affSColin Finck SET(pbad_cast_scalar_dtor, "??_Gbad_cast@@UAEPAXI@Z");
322c2c66affSColin Finck
323c2c66affSColin Finck SET(p__non_rtti_object_ctor, "??0__non_rtti_object@@QAE@PBD@Z");
324c2c66affSColin Finck SET(p__non_rtti_object_copy_ctor, "??0__non_rtti_object@@QAE@ABV0@@Z");
325c2c66affSColin Finck SET(p__non_rtti_object_dtor, "??1__non_rtti_object@@UAE@XZ");
326c2c66affSColin Finck SET(p__non_rtti_object_opequals, "??4__non_rtti_object@@QAEAAV0@ABV0@@Z");
327c2c66affSColin Finck SET(p__non_rtti_object_what, "?what@exception@@UBEPBDXZ");
328c2c66affSColin Finck SET(p__non_rtti_object_vector_dtor, "??_E__non_rtti_object@@UAEPAXI@Z");
329c2c66affSColin Finck SET(p__non_rtti_object_scalar_dtor, "??_G__non_rtti_object@@UAEPAXI@Z");
330c2c66affSColin Finck
331c2c66affSColin Finck SET(ptype_info_dtor, "??1type_info@@UAE@XZ");
332c2c66affSColin Finck SET(ptype_info_raw_name, "?raw_name@type_info@@QBEPBDXZ");
333c2c66affSColin Finck SET(ptype_info_name, "?name@type_info@@QBEPBDXZ");
334c2c66affSColin Finck SET(ptype_info_before, "?before@type_info@@QBEHABV1@@Z");
335c2c66affSColin Finck SET(ptype_info_opequals_equals, "??8type_info@@QBEHABV0@@Z");
336c2c66affSColin Finck SET(ptype_info_opnot_equals, "??9type_info@@QBEHABV0@@Z");
337c2c66affSColin Finck #endif /* __arm__ */
338c2c66affSColin Finck }
339c2c66affSColin Finck
340c2c66affSColin Finck if (!poperator_new)
341c2c66affSColin Finck poperator_new = pmalloc;
342c2c66affSColin Finck if (!poperator_delete)
343c2c66affSColin Finck poperator_delete = pfree;
344c2c66affSColin Finck
345c2c66affSColin Finck init_thiscall_thunk();
346c2c66affSColin Finck return TRUE;
347c2c66affSColin Finck }
348c2c66affSColin Finck
test_exception(void)349c2c66affSColin Finck static void test_exception(void)
350c2c66affSColin Finck {
351c2c66affSColin Finck static const char* e_name = "An exception name";
352c2c66affSColin Finck char* name;
353c2c66affSColin Finck exception e, e2, e3, *pe;
354c2c66affSColin Finck
355c2c66affSColin Finck if (!poperator_new || !poperator_delete ||
356c2c66affSColin Finck !pexception_ctor || !pexception_copy_ctor || !pexception_default_ctor ||
357c2c66affSColin Finck !pexception_dtor || !pexception_opequals || !pexception_what ||
358c2c66affSColin Finck !pexception_vtable || !pexception_vector_dtor || !pexception_scalar_dtor)
359c2c66affSColin Finck return;
360c2c66affSColin Finck
361c2c66affSColin Finck /* 'const char*&' ctor */
362c2c66affSColin Finck memset(&e, 0, sizeof(e));
363c2c66affSColin Finck call_func2(pexception_ctor, &e, &e_name);
364c2c66affSColin Finck ok(e.vtable != NULL, "Null exception vtable for e\n");
365c2c66affSColin Finck ok(e.name && e.name != e_name && !strcmp(e.name, "An exception name"), "Bad name '%s' for e\n", e.name);
366c2c66affSColin Finck ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
367c2c66affSColin Finck
368c2c66affSColin Finck /* Copy ctor */
369c2c66affSColin Finck memset(&e2, 0, sizeof(e2));
370c2c66affSColin Finck call_func2(pexception_copy_ctor, &e2, &e);
371c2c66affSColin Finck ok(e2.vtable != NULL, "Null exception vtable for e2\n");
372c2c66affSColin Finck ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n");
373c2c66affSColin Finck ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
374c2c66affSColin Finck
375c2c66affSColin Finck /* Default ctor */
376c2c66affSColin Finck memset(&e3, 1, sizeof(e3));
377c2c66affSColin Finck call_func1(pexception_default_ctor, &e3);
378c2c66affSColin Finck ok(e3.vtable != NULL, "Null exception vtable for e3\n");
379c2c66affSColin Finck ok(e3.name == NULL, "Bad exception name for e3\n");
380c2c66affSColin Finck ok(e3.do_free == 0, "do_free set to %d for e3\n", e3.do_free);
381c2c66affSColin Finck
382c2c66affSColin Finck ok(e.vtable == e2.vtable && e.vtable == e3.vtable, "exception vtables differ!\n");
383c2c66affSColin Finck
384c2c66affSColin Finck /* Test calling the dtors */
385c2c66affSColin Finck call_func1(pexception_dtor, &e2);
386c2c66affSColin Finck call_func1(pexception_dtor, &e3);
387c2c66affSColin Finck
388c2c66affSColin Finck /* Operator equals */
389c2c66affSColin Finck memset(&e2, 0, sizeof(e2));
390c2c66affSColin Finck call_func1(pexception_default_ctor, &e2);
391c2c66affSColin Finck pe = call_func2(pexception_opequals, &e2, &e);
392c2c66affSColin Finck ok(e2.vtable != NULL, "Null exception vtable for e2\n");
393c2c66affSColin Finck ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n");
394c2c66affSColin Finck ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
395c2c66affSColin Finck ok(pe == &e2, "opequals didn't return e2\n");
396c2c66affSColin Finck
397c2c66affSColin Finck /* what() */
398c2c66affSColin Finck name = call_func1(pexception_what, &e2);
399c2c66affSColin Finck ok(e2.name == name, "Bad exception name from e2::what()\n");
400c2c66affSColin Finck
401c2c66affSColin Finck /* vtable ptr */
402c2c66affSColin Finck ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
403c2c66affSColin Finck call_func1(pexception_dtor, &e2);
404c2c66affSColin Finck
405c2c66affSColin Finck /* new() */
406c2c66affSColin Finck pe = poperator_new(sizeof(exception));
407c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
408c2c66affSColin Finck if (pe)
409c2c66affSColin Finck {
410c2c66affSColin Finck call_func2(pexception_ctor, pe, &e_name);
411c2c66affSColin Finck /* scalar dtor */
412c2c66affSColin Finck call_func2(pexception_scalar_dtor, pe, 0); /* Shouldn't delete pe */
413c2c66affSColin Finck pe->name = NULL;
414c2c66affSColin Finck pe->do_free = 0;
415c2c66affSColin Finck call_func2(pexception_scalar_dtor, pe, 1); /* Should delete pe */
416c2c66affSColin Finck }
417c2c66affSColin Finck
418c2c66affSColin Finck pe = poperator_new(sizeof(exception));
419c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
420c2c66affSColin Finck if (pe)
421c2c66affSColin Finck {
422c2c66affSColin Finck /* vector dtor, single element */
423c2c66affSColin Finck call_func2(pexception_ctor, pe, &e_name);
424c2c66affSColin Finck call_func2(pexception_vector_dtor, pe, 1); /* Should delete pe as single element*/
425c2c66affSColin Finck }
426c2c66affSColin Finck
427c2c66affSColin Finck pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
428c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
429c2c66affSColin Finck if (pe)
430c2c66affSColin Finck {
431c2c66affSColin Finck /* vector dtor, multiple elements */
432c2c66affSColin Finck char name[] = "a constant";
433c2c66affSColin Finck *((size_t*)pe) = 3;
434c2c66affSColin Finck pe = (exception*)((size_t*)pe + 1);
435c2c66affSColin Finck call_func2(pexception_ctor, &pe[0], &e_name);
436c2c66affSColin Finck call_func2(pexception_ctor, &pe[1], &e_name);
437c2c66affSColin Finck call_func2(pexception_ctor, &pe[2], &e_name);
438c2c66affSColin Finck pe[3].name = name;
439c2c66affSColin Finck pe[3].do_free = 1; /* Crash if we try to free this */
440c2c66affSColin Finck call_func2(pexception_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
441c2c66affSColin Finck }
442c2c66affSColin Finck
443c2c66affSColin Finck /* test our exported vtable is kosher */
444c2c66affSColin Finck pe = (void*)pexception_vtable; /* Use the exception struct to get vtable ptrs */
445c2c66affSColin Finck pexception_vector_dtor = (void*)pe->vtable;
446c2c66affSColin Finck pexception_what = (void*)pe->name;
447c2c66affSColin Finck
448c2c66affSColin Finck name = call_func1(pexception_what, &e);
449c2c66affSColin Finck ok(e.name == name, "Bad exception name from vtable e::what()\n");
450c2c66affSColin Finck
451c2c66affSColin Finck if (p__RTtypeid && !bAncientVersion)
452c2c66affSColin Finck {
453c2c66affSColin Finck /* Check the rtti */
454c2c66affSColin Finck type_info *ti = p__RTtypeid(&e);
455c2c66affSColin Finck ok (ti && !strcmp(ti->mangled, ".?AVexception@@"), "bad rtti for e\n");
456c2c66affSColin Finck
457c2c66affSColin Finck if (ti)
458c2c66affSColin Finck {
459c2c66affSColin Finck /* Check the returned type_info has rtti too */
460c2c66affSColin Finck type_info *ti2 = p__RTtypeid(ti);
461c2c66affSColin Finck ok (ti2 != NULL && !strcmp(ti2->mangled, ".?AVtype_info@@"), "bad rtti for e's type_info\n");
462c2c66affSColin Finck }
463c2c66affSColin Finck }
464c2c66affSColin Finck
465c2c66affSColin Finck call_func2(pexception_vector_dtor, &e, 0); /* Should delete e.name, but not e */
466c2c66affSColin Finck }
467c2c66affSColin Finck
468c2c66affSColin Finck /* This test is basically a cut 'n' paste of the exception test. but it verifies that
469c2c66affSColin Finck * bad_typeid works the exact same way... */
test_bad_typeid(void)470c2c66affSColin Finck static void test_bad_typeid(void)
471c2c66affSColin Finck {
472c2c66affSColin Finck static const char* e_name = "A bad_typeid name";
473c2c66affSColin Finck char* name;
474c2c66affSColin Finck exception e, e2, e3, *pe;
475c2c66affSColin Finck
476c2c66affSColin Finck if (!poperator_new || !poperator_delete ||
477c2c66affSColin Finck !pbad_typeid_ctor || !pbad_typeid_copy_ctor ||
478c2c66affSColin Finck !pbad_typeid_dtor || !pbad_typeid_opequals || !pbad_typeid_what ||
479c2c66affSColin Finck !pbad_typeid_vtable || !pbad_typeid_vector_dtor || !pbad_typeid_scalar_dtor)
480c2c66affSColin Finck return;
481c2c66affSColin Finck
482c2c66affSColin Finck /* 'const char*' ctor */
483c2c66affSColin Finck memset(&e, 0, sizeof(e));
484c2c66affSColin Finck call_func2(pbad_typeid_ctor, &e, e_name);
485c2c66affSColin Finck ok(e.vtable != NULL, "Null bad_typeid vtable for e\n");
486c2c66affSColin Finck ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_typeid name"), "Bad name '%s' for e\n", e.name);
487c2c66affSColin Finck ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
488c2c66affSColin Finck
489c2c66affSColin Finck /* Copy ctor */
490c2c66affSColin Finck memset(&e2, 0, sizeof(e2));
491c2c66affSColin Finck call_func2(pbad_typeid_copy_ctor, &e2, &e);
492c2c66affSColin Finck ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n");
493c2c66affSColin Finck ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad name '%s' for e2\n", e2.name);
494c2c66affSColin Finck ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
495c2c66affSColin Finck
496c2c66affSColin Finck /* Ctor closure */
497c2c66affSColin Finck if (pbad_typeid_ctor_closure)
498c2c66affSColin Finck {
499c2c66affSColin Finck memset(&e3, 1, sizeof(e3));
500c2c66affSColin Finck call_func1(pbad_typeid_ctor_closure, &e3);
501c2c66affSColin Finck ok(e3.vtable != NULL, "Null bad_typeid vtable for e3\n");
502c2c66affSColin Finck ok(e3.name && !strcmp(e3.name, "bad typeid"), "Bad bad_typeid name for e3\n");
503c2c66affSColin Finck ok(e3.do_free == 1, "do_free set to %d for e3\n", e3.do_free);
504c2c66affSColin Finck ok(e.vtable == e3.vtable, "bad_typeid closure vtables differ!\n");
505c2c66affSColin Finck call_func1(pbad_typeid_dtor, &e3);
506c2c66affSColin Finck }
507c2c66affSColin Finck ok(e.vtable == e2.vtable, "bad_typeid vtables differ!\n");
508c2c66affSColin Finck
509c2c66affSColin Finck /* Test calling the dtors */
510c2c66affSColin Finck call_func1(pbad_typeid_dtor, &e2);
511c2c66affSColin Finck
512c2c66affSColin Finck /* Operator equals */
513c2c66affSColin Finck memset(&e2, 1, sizeof(e2));
514c2c66affSColin Finck call_func1(pexception_default_ctor, &e2);
515c2c66affSColin Finck pe = call_func2(pbad_typeid_opequals, &e2, &e);
516c2c66affSColin Finck ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n");
517c2c66affSColin Finck ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad bad_typeid name for e2\n");
518c2c66affSColin Finck ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
519c2c66affSColin Finck ok(pe == &e2, "opequals didn't return e2\n");
520c2c66affSColin Finck
521c2c66affSColin Finck /* what() */
522c2c66affSColin Finck name = call_func1(pbad_typeid_what, &e2);
523c2c66affSColin Finck ok(e2.name == name, "Bad bad_typeid name from e2::what()\n");
524c2c66affSColin Finck
525c2c66affSColin Finck /* vtable ptr */
526c2c66affSColin Finck ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
527c2c66affSColin Finck call_func1(pbad_typeid_dtor, &e2);
528c2c66affSColin Finck
529c2c66affSColin Finck /* new() */
530c2c66affSColin Finck pe = poperator_new(sizeof(exception));
531c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
532c2c66affSColin Finck if (pe)
533c2c66affSColin Finck {
534c2c66affSColin Finck call_func2(pbad_typeid_ctor, pe, e_name);
535c2c66affSColin Finck /* scalar dtor */
536c2c66affSColin Finck call_func2(pbad_typeid_scalar_dtor, pe, 0); /* Shouldn't delete pe */
537c2c66affSColin Finck pe->name = NULL;
538c2c66affSColin Finck pe->do_free = 0;
539c2c66affSColin Finck call_func2(pbad_typeid_scalar_dtor, pe, 1); /* Should delete pe */
540c2c66affSColin Finck }
541c2c66affSColin Finck
542c2c66affSColin Finck pe = poperator_new(sizeof(exception));
543c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
544c2c66affSColin Finck if (pe)
545c2c66affSColin Finck {
546c2c66affSColin Finck /* vector dtor, single element */
547c2c66affSColin Finck call_func2(pbad_typeid_ctor, pe, e_name);
548c2c66affSColin Finck call_func2(pbad_typeid_vector_dtor, pe, 1); /* Should delete pe as single element*/
549c2c66affSColin Finck }
550c2c66affSColin Finck
551c2c66affSColin Finck pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
552c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
553c2c66affSColin Finck if (pe)
554c2c66affSColin Finck {
555c2c66affSColin Finck /* vector dtor, multiple elements */
556c2c66affSColin Finck *((size_t*)pe) = 3;
557c2c66affSColin Finck pe = (exception*)((size_t*)pe + 1);
558c2c66affSColin Finck call_func2(pbad_typeid_ctor, &pe[0], e_name);
559c2c66affSColin Finck call_func2(pbad_typeid_ctor, &pe[1], e_name);
560c2c66affSColin Finck call_func2(pbad_typeid_ctor, &pe[2], e_name);
561c2c66affSColin Finck pe[3].name = 0;
562c2c66affSColin Finck pe[3].do_free = 1; /* Crash if we try to free this element */
563c2c66affSColin Finck call_func2(pbad_typeid_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
564c2c66affSColin Finck }
565c2c66affSColin Finck
566c2c66affSColin Finck /* test our exported vtable is kosher */
567c2c66affSColin Finck pe = (void*)pbad_typeid_vtable; /* Use the exception struct to get vtable ptrs */
568c2c66affSColin Finck pbad_typeid_vector_dtor = (void*)pe->vtable;
569c2c66affSColin Finck pbad_typeid_what = (void*)pe->name;
570c2c66affSColin Finck
571c2c66affSColin Finck name = call_func1(pbad_typeid_what, &e);
572c2c66affSColin Finck ok(e.name == name, "Bad bad_typeid name from vtable e::what()\n");
573c2c66affSColin Finck
574c2c66affSColin Finck if (p__RTtypeid && !bAncientVersion)
575c2c66affSColin Finck {
576c2c66affSColin Finck /* Check the rtti */
577c2c66affSColin Finck type_info *ti = p__RTtypeid(&e);
578c2c66affSColin Finck ok (ti != NULL && !strcmp(ti->mangled, ".?AVbad_typeid@@"), "bad rtti for e (%s)\n",
579c2c66affSColin Finck !ti ? "null" : ti->mangled);
580c2c66affSColin Finck }
581c2c66affSColin Finck
582c2c66affSColin Finck call_func2(pbad_typeid_vector_dtor, &e, 0); /* Should delete e.name, but not e */
583c2c66affSColin Finck }
584c2c66affSColin Finck
585c2c66affSColin Finck
586c2c66affSColin Finck /* Ditto for this test... */
test_bad_cast(void)587c2c66affSColin Finck static void test_bad_cast(void)
588c2c66affSColin Finck {
589c2c66affSColin Finck static const char* e_name = "A bad_cast name";
590c2c66affSColin Finck char* name;
591c2c66affSColin Finck exception e, e2, e3, *pe;
592c2c66affSColin Finck
593c2c66affSColin Finck if (!poperator_new || !poperator_delete ||
594c2c66affSColin Finck !pbad_cast_ctor || !pbad_cast_copy_ctor ||
595c2c66affSColin Finck !pbad_cast_dtor || !pbad_cast_opequals || !pbad_cast_what ||
596c2c66affSColin Finck !pbad_cast_vtable || !pbad_cast_vector_dtor || !pbad_cast_scalar_dtor)
597c2c66affSColin Finck return;
598c2c66affSColin Finck
599c2c66affSColin Finck if (pbad_cast_ctor2)
600c2c66affSColin Finck {
601c2c66affSColin Finck /* 'const char*' ctor */
602c2c66affSColin Finck memset(&e, 0, sizeof(e));
603c2c66affSColin Finck call_func2(pbad_cast_ctor2, &e, e_name);
604c2c66affSColin Finck ok(e.vtable != NULL, "Null bad_cast vtable for e\n");
605c2c66affSColin Finck ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_cast name"), "Bad name '%s' for e\n", e.name);
606c2c66affSColin Finck ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
607c2c66affSColin Finck call_func1(pbad_cast_dtor, &e);
608c2c66affSColin Finck }
609c2c66affSColin Finck
610c2c66affSColin Finck /* 'const char*&' ctor */
611c2c66affSColin Finck memset(&e, 0, sizeof(e));
612c2c66affSColin Finck call_func2(pbad_cast_ctor, &e, &e_name);
613c2c66affSColin Finck ok(e.vtable != NULL, "Null bad_cast vtable for e\n");
614c2c66affSColin Finck ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_cast name"), "Bad name '%s' for e\n", e.name);
615c2c66affSColin Finck ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
616c2c66affSColin Finck
617c2c66affSColin Finck /* Copy ctor */
618c2c66affSColin Finck memset(&e2, 0, sizeof(e2));
619c2c66affSColin Finck call_func2(pbad_cast_copy_ctor, &e2, &e);
620c2c66affSColin Finck ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n");
621c2c66affSColin Finck ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad name '%s' for e2\n", e2.name);
622c2c66affSColin Finck ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
623c2c66affSColin Finck
624c2c66affSColin Finck /* Ctor closure */
625c2c66affSColin Finck if (pbad_cast_ctor_closure)
626c2c66affSColin Finck {
627c2c66affSColin Finck memset(&e3, 1, sizeof(e3));
628c2c66affSColin Finck call_func1(pbad_cast_ctor_closure, &e3);
629c2c66affSColin Finck ok(e3.vtable != NULL, "Null bad_cast vtable for e3\n");
630c2c66affSColin Finck ok(e3.name && !strcmp(e3.name, "bad cast"), "Bad bad_cast name for e3\n");
631c2c66affSColin Finck ok(e3.do_free == 1, "do_free set to %d for e3\n", e3.do_free);
632c2c66affSColin Finck ok(e.vtable == e3.vtable, "bad_cast closure vtables differ!\n");
633c2c66affSColin Finck call_func1(pbad_cast_dtor, &e3);
634c2c66affSColin Finck }
635c2c66affSColin Finck ok(e.vtable == e2.vtable, "bad_cast vtables differ!\n");
636c2c66affSColin Finck
637c2c66affSColin Finck /* Test calling the dtors */
638c2c66affSColin Finck call_func1(pbad_cast_dtor, &e2);
639c2c66affSColin Finck
640c2c66affSColin Finck /* Operator equals */
641c2c66affSColin Finck memset(&e2, 1, sizeof(e2));
642c2c66affSColin Finck call_func1(pexception_default_ctor, &e2);
643c2c66affSColin Finck pe = call_func2(pbad_cast_opequals, &e2, &e);
644c2c66affSColin Finck ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n");
645c2c66affSColin Finck ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad bad_cast name for e2\n");
646c2c66affSColin Finck ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
647c2c66affSColin Finck ok(pe == &e2, "opequals didn't return e2\n");
648c2c66affSColin Finck
649c2c66affSColin Finck /* what() */
650c2c66affSColin Finck name = call_func1(pbad_cast_what, &e2);
651c2c66affSColin Finck ok(e2.name == name, "Bad bad_cast name from e2::what()\n");
652c2c66affSColin Finck
653c2c66affSColin Finck /* vtable ptr */
654c2c66affSColin Finck ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
655c2c66affSColin Finck call_func1(pbad_cast_dtor, &e2);
656c2c66affSColin Finck
657c2c66affSColin Finck /* new() */
658c2c66affSColin Finck pe = poperator_new(sizeof(exception));
659c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
660c2c66affSColin Finck if (pe)
661c2c66affSColin Finck {
662c2c66affSColin Finck call_func2(pbad_cast_ctor, pe, &e_name);
663c2c66affSColin Finck /* scalar dtor */
664c2c66affSColin Finck call_func2(pbad_cast_scalar_dtor, pe, 0); /* Shouldn't delete pe */
665c2c66affSColin Finck pe->name = NULL;
666c2c66affSColin Finck pe->do_free = 0;
667c2c66affSColin Finck call_func2(pbad_cast_scalar_dtor, pe, 1); /* Should delete pe */
668c2c66affSColin Finck }
669c2c66affSColin Finck
670c2c66affSColin Finck pe = poperator_new(sizeof(exception));
671c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
672c2c66affSColin Finck if (pe)
673c2c66affSColin Finck {
674c2c66affSColin Finck /* vector dtor, single element */
675c2c66affSColin Finck call_func2(pbad_cast_ctor, pe, &e_name);
676c2c66affSColin Finck call_func2(pbad_cast_vector_dtor, pe, 1); /* Should delete pe as single element*/
677c2c66affSColin Finck }
678c2c66affSColin Finck
679c2c66affSColin Finck pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
680c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
681c2c66affSColin Finck if (pe)
682c2c66affSColin Finck {
683c2c66affSColin Finck /* vector dtor, multiple elements */
684c2c66affSColin Finck *((size_t*)pe) = 3;
685c2c66affSColin Finck pe = (exception*)((size_t*)pe + 1);
686c2c66affSColin Finck call_func2(pbad_cast_ctor, &pe[0], &e_name);
687c2c66affSColin Finck call_func2(pbad_cast_ctor, &pe[1], &e_name);
688c2c66affSColin Finck call_func2(pbad_cast_ctor, &pe[2], &e_name);
689c2c66affSColin Finck pe[3].name = 0;
690c2c66affSColin Finck pe[3].do_free = 1; /* Crash if we try to free this element */
691c2c66affSColin Finck call_func2(pbad_cast_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
692c2c66affSColin Finck }
693c2c66affSColin Finck
694c2c66affSColin Finck /* test our exported vtable is kosher */
695c2c66affSColin Finck pe = (void*)pbad_cast_vtable; /* Use the exception struct to get vtable ptrs */
696c2c66affSColin Finck pbad_cast_vector_dtor = (void*)pe->vtable;
697c2c66affSColin Finck pbad_cast_what = (void*)pe->name;
698c2c66affSColin Finck
699c2c66affSColin Finck name = call_func1(pbad_cast_what, &e);
700c2c66affSColin Finck ok(e.name == name, "Bad bad_cast name from vtable e::what()\n");
701c2c66affSColin Finck
702c2c66affSColin Finck if (p__RTtypeid && !bAncientVersion)
703c2c66affSColin Finck {
704c2c66affSColin Finck /* Check the rtti */
705c2c66affSColin Finck type_info *ti = p__RTtypeid(&e);
706c2c66affSColin Finck ok (ti != NULL && !strcmp(ti->mangled, ".?AVbad_cast@@"), "bad rtti for e\n");
707c2c66affSColin Finck }
708c2c66affSColin Finck call_func2(pbad_cast_vector_dtor, &e, 0); /* Should delete e.name, but not e */
709c2c66affSColin Finck }
710c2c66affSColin Finck
711c2c66affSColin Finck /* ... and this one */
test___non_rtti_object(void)712c2c66affSColin Finck static void test___non_rtti_object(void)
713c2c66affSColin Finck {
714c2c66affSColin Finck static const char* e_name = "A __non_rtti_object name";
715c2c66affSColin Finck char* name;
716c2c66affSColin Finck exception e, e2, *pe;
717c2c66affSColin Finck
718c2c66affSColin Finck if (!poperator_new || !poperator_delete ||
719c2c66affSColin Finck !p__non_rtti_object_ctor || !p__non_rtti_object_copy_ctor ||
720c2c66affSColin Finck !p__non_rtti_object_dtor || !p__non_rtti_object_opequals || !p__non_rtti_object_what ||
721c2c66affSColin Finck !p__non_rtti_object_vtable || !p__non_rtti_object_vector_dtor || !p__non_rtti_object_scalar_dtor)
722c2c66affSColin Finck return;
723c2c66affSColin Finck
724c2c66affSColin Finck /* 'const char*' ctor */
725c2c66affSColin Finck memset(&e, 0, sizeof(e));
726c2c66affSColin Finck call_func2(p__non_rtti_object_ctor, &e, e_name);
727c2c66affSColin Finck ok(e.vtable != NULL, "Null __non_rtti_object vtable for e\n");
728c2c66affSColin Finck ok(e.name && e.name != e_name && !strcmp(e.name, "A __non_rtti_object name"), "Bad name '%s' for e\n", e.name);
729c2c66affSColin Finck ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
730c2c66affSColin Finck
731c2c66affSColin Finck /* Copy ctor */
732c2c66affSColin Finck memset(&e2, 0, sizeof(e2));
733c2c66affSColin Finck call_func2(p__non_rtti_object_copy_ctor, &e2, &e);
734c2c66affSColin Finck ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n");
735c2c66affSColin Finck ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad name '%s' for e2\n", e2.name);
736c2c66affSColin Finck ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
737c2c66affSColin Finck ok(e.vtable == e2.vtable, "__non_rtti_object vtables differ!\n");
738c2c66affSColin Finck
739c2c66affSColin Finck /* Test calling the dtors */
740c2c66affSColin Finck call_func1(p__non_rtti_object_dtor, &e2);
741c2c66affSColin Finck
742c2c66affSColin Finck /* Operator equals */
743c2c66affSColin Finck memset(&e2, 1, sizeof(e2));
744c2c66affSColin Finck call_func1(pexception_default_ctor, &e2);
745c2c66affSColin Finck pe = call_func2(p__non_rtti_object_opequals, &e2, &e);
746c2c66affSColin Finck ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n");
747c2c66affSColin Finck ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad __non_rtti_object name for e2\n");
748c2c66affSColin Finck ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
749c2c66affSColin Finck ok(pe == &e2, "opequals didn't return e2\n");
750c2c66affSColin Finck
751c2c66affSColin Finck /* what() */
752c2c66affSColin Finck name = call_func1(p__non_rtti_object_what, &e2);
753c2c66affSColin Finck ok(e2.name == name, "Bad __non_rtti_object name from e2::what()\n");
754c2c66affSColin Finck
755c2c66affSColin Finck /* vtable ptr */
756c2c66affSColin Finck ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
757c2c66affSColin Finck call_func1(p__non_rtti_object_dtor, &e2);
758c2c66affSColin Finck
759c2c66affSColin Finck /* new() */
760c2c66affSColin Finck pe = poperator_new(sizeof(exception));
761c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
762c2c66affSColin Finck if (pe)
763c2c66affSColin Finck {
764c2c66affSColin Finck call_func2(p__non_rtti_object_ctor, pe, e_name);
765c2c66affSColin Finck /* scalar dtor */
766c2c66affSColin Finck call_func2(p__non_rtti_object_scalar_dtor, pe, 0); /* Shouldn't delete pe */
767c2c66affSColin Finck pe->name = NULL;
768c2c66affSColin Finck pe->do_free = 0;
769c2c66affSColin Finck call_func2(p__non_rtti_object_scalar_dtor, pe, 1); /* Should delete pe */
770c2c66affSColin Finck }
771c2c66affSColin Finck
772c2c66affSColin Finck pe = poperator_new(sizeof(exception));
773c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
774c2c66affSColin Finck if (pe)
775c2c66affSColin Finck {
776c2c66affSColin Finck /* vector dtor, single element */
777c2c66affSColin Finck call_func2(p__non_rtti_object_ctor, pe, e_name);
778c2c66affSColin Finck call_func2(p__non_rtti_object_vector_dtor, pe, 1); /* Should delete pe as single element*/
779c2c66affSColin Finck }
780c2c66affSColin Finck
781c2c66affSColin Finck pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
782c2c66affSColin Finck ok(pe != NULL, "new() failed\n");
783c2c66affSColin Finck if (pe)
784c2c66affSColin Finck {
785c2c66affSColin Finck /* vector dtor, multiple elements */
786c2c66affSColin Finck *((size_t*)pe) = 3;
787c2c66affSColin Finck pe = (exception*)((size_t*)pe + 1);
788c2c66affSColin Finck call_func2(p__non_rtti_object_ctor, &pe[0], e_name);
789c2c66affSColin Finck call_func2(p__non_rtti_object_ctor, &pe[1], e_name);
790c2c66affSColin Finck call_func2(p__non_rtti_object_ctor, &pe[2], e_name);
791c2c66affSColin Finck pe[3].name = 0;
792c2c66affSColin Finck pe[3].do_free = 1; /* Crash if we try to free this element */
793c2c66affSColin Finck call_func2(p__non_rtti_object_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
794c2c66affSColin Finck }
795c2c66affSColin Finck
796c2c66affSColin Finck /* test our exported vtable is kosher */
797c2c66affSColin Finck pe = (void*)p__non_rtti_object_vtable; /* Use the exception struct to get vtable ptrs */
798c2c66affSColin Finck p__non_rtti_object_vector_dtor = (void*)pe->vtable;
799c2c66affSColin Finck p__non_rtti_object_what = (void*)pe->name;
800c2c66affSColin Finck
801c2c66affSColin Finck name = call_func1(p__non_rtti_object_what, &e);
802c2c66affSColin Finck ok(e.name == name, "Bad __non_rtti_object name from vtable e::what()\n");
803c2c66affSColin Finck
804c2c66affSColin Finck if (p__RTtypeid && !bAncientVersion)
805c2c66affSColin Finck {
806c2c66affSColin Finck /* Check the rtti */
807c2c66affSColin Finck type_info *ti = p__RTtypeid(&e);
808c2c66affSColin Finck ok (ti != NULL && !strcmp(ti->mangled, ".?AV__non_rtti_object@@"), "bad rtti for e\n");
809c2c66affSColin Finck }
810c2c66affSColin Finck call_func2(p__non_rtti_object_vector_dtor, &e, 0); /* Should delete e.name, but not e */
811c2c66affSColin Finck }
812c2c66affSColin Finck
test_type_info(void)813c2c66affSColin Finck static void test_type_info(void)
814c2c66affSColin Finck {
815c2c66affSColin Finck static type_info t1 = { NULL, NULL,{'.','?','A','V','t','e','s','t','1','@','@',0,0,0,0,0 } };
816c2c66affSColin Finck static type_info t1_1 = { NULL, NULL,{'?','?','A','V','t','e','s','t','1','@','@',0,0,0,0,0 } };
817c2c66affSColin Finck static type_info t2 = { NULL, NULL, {'.','?','A','V','t','e','s','t','2','@','@',0,0,0,0,0 } };
818c2c66affSColin Finck char* name;
819c2c66affSColin Finck int res;
820c2c66affSColin Finck
821c2c66affSColin Finck if (!pmalloc || !pfree || !ptype_info_dtor || !ptype_info_raw_name ||
822c2c66affSColin Finck !ptype_info_name || !ptype_info_before ||
823c2c66affSColin Finck !ptype_info_opequals_equals || !ptype_info_opnot_equals)
824c2c66affSColin Finck return;
825c2c66affSColin Finck
826c2c66affSColin Finck /* Test calling the dtors */
827c2c66affSColin Finck call_func1(ptype_info_dtor, &t1); /* No effect, since name is NULL */
828c2c66affSColin Finck t1.name = pmalloc(64);
829c2c66affSColin Finck strcpy(t1.name, "foo");
830c2c66affSColin Finck call_func1(ptype_info_dtor, &t1); /* Frees t1.name using 'free' */
831c2c66affSColin Finck
832c2c66affSColin Finck /* raw_name */
833c2c66affSColin Finck t1.name = NULL;
834c2c66affSColin Finck name = call_func1(ptype_info_raw_name, &t1);
835c2c66affSColin Finck
836c2c66affSColin Finck /* FIXME: This fails on native; it shouldn't though - native bug?
837c2c66affSColin Finck * ok(name && !strcmp(name, t1.mangled), "bad raw_name '%s' for t1 (expected '%s')\n", name, t1.mangled);
838c2c66affSColin Finck */
839c2c66affSColin Finck ok(t1.name == NULL, "raw_name() set name for t1\n");
840c2c66affSColin Finck
841c2c66affSColin Finck /* name */
842c2c66affSColin Finck t1.name = NULL;
843c2c66affSColin Finck name = call_func1(ptype_info_name, &t1);
844c2c66affSColin Finck ok(name && t1.name && !strcmp(name, t1.name), "bad name '%s' for t1\n", name);
845c2c66affSColin Finck
846c2c66affSColin Finck ok(t1.name && !strcmp(t1.name, "class test1"), "demangled to '%s' for t1\n", t1.name);
847c2c66affSColin Finck call_func1(ptype_info_dtor, &t1);
848c2c66affSColin Finck
849c2c66affSColin Finck /* before */
850c2c66affSColin Finck t1.name = NULL;
851c2c66affSColin Finck res = (int)call_func2(ptype_info_before, &t1, &t1);
852c2c66affSColin Finck ok(res == 0, "expected 0, got %d\n", res);
853c2c66affSColin Finck res = (int)call_func2(ptype_info_before, &t2, &t1);
854c2c66affSColin Finck ok(res == 0, "expected 0, got %d\n", res);
855c2c66affSColin Finck res = (int)call_func2(ptype_info_before, &t1, &t2);
856c2c66affSColin Finck ok(res == 1, "expected 1, got %d\n", res);
857c2c66affSColin Finck /* Doesn't check first char */
858c2c66affSColin Finck res = (int)call_func2(ptype_info_before, &t1, &t1_1);
859c2c66affSColin Finck ok(res == 0, "expected 0, got %d\n", res);
860c2c66affSColin Finck
861c2c66affSColin Finck /* opequals_equals */
862c2c66affSColin Finck t1.name = NULL;
863c2c66affSColin Finck res = (int)call_func2(ptype_info_opequals_equals, &t1, &t1);
864c2c66affSColin Finck ok(res == 1, "expected 1, got %d\n", res);
865c2c66affSColin Finck res = (int)call_func2(ptype_info_opequals_equals, &t1, &t2);
866c2c66affSColin Finck ok(res == 0, "expected 0, got %d\n", res);
867c2c66affSColin Finck res = (int)call_func2(ptype_info_opequals_equals, &t2, &t1);
868c2c66affSColin Finck ok(res == 0, "expected 0, got %d\n", res);
869c2c66affSColin Finck
870c2c66affSColin Finck /* opnot_equals */
871c2c66affSColin Finck t1.name = NULL;
872c2c66affSColin Finck res = (int)call_func2(ptype_info_opnot_equals, &t1, &t1);
873c2c66affSColin Finck ok(res == 0, "expected 0, got %d\n", res);
874c2c66affSColin Finck res = (int)call_func2(ptype_info_opnot_equals, &t1, &t2);
875c2c66affSColin Finck ok(res == 1, "expected 1, got %d\n", res);
876c2c66affSColin Finck res = (int)call_func2(ptype_info_opnot_equals, &t2, &t1);
877c2c66affSColin Finck ok(res == 1, "expected 1, got %d\n", res);
878c2c66affSColin Finck }
879c2c66affSColin Finck
get_vtable(void * obj)880c2c66affSColin Finck static inline vtable_ptr *get_vtable( void *obj )
881c2c66affSColin Finck {
882c2c66affSColin Finck return *(vtable_ptr **)obj;
883c2c66affSColin Finck }
884c2c66affSColin Finck
get_obj_locator(void * cppobj)885c2c66affSColin Finck static inline void/*rtti_object_locator*/ *get_obj_locator( void *cppobj )
886c2c66affSColin Finck {
887c2c66affSColin Finck const vtable_ptr *vtable = get_vtable( cppobj );
888c2c66affSColin Finck return (void *)vtable[-1];
889c2c66affSColin Finck }
890c2c66affSColin Finck
891c2c66affSColin Finck #ifndef __x86_64__
892c2c66affSColin Finck #define DEFINE_RTTI_REF(type, name) type *name
893c2c66affSColin Finck #define RTTI_REF(instance, name) &instance.name
894c2c66affSColin Finck #define RTTI_REF_SIG0(instance, name, base) RTTI_REF(instance, name)
895c2c66affSColin Finck #else
896c2c66affSColin Finck #define DEFINE_RTTI_REF(type, name) unsigned name
897c2c66affSColin Finck #define RTTI_REF(instance, name) FIELD_OFFSET(struct rtti_data, name)
898c2c66affSColin Finck #define RTTI_REF_SIG0(instance, name, base) ((char*)&instance.name-base)
899c2c66affSColin Finck #endif
900c2c66affSColin Finck /* Test RTTI functions */
test_rtti(void)901c2c66affSColin Finck static void test_rtti(void)
902c2c66affSColin Finck {
903c2c66affSColin Finck struct _object_locator
904c2c66affSColin Finck {
905c2c66affSColin Finck unsigned int signature;
906c2c66affSColin Finck int base_class_offset;
907c2c66affSColin Finck unsigned int flags;
908c2c66affSColin Finck DEFINE_RTTI_REF(type_info, type_descriptor);
909c2c66affSColin Finck DEFINE_RTTI_REF(struct _rtti_object_hierarchy, type_hierarchy);
910c2c66affSColin Finck DEFINE_RTTI_REF(void, object_locator);
911c2c66affSColin Finck } *obj_locator;
912c2c66affSColin Finck
913c2c66affSColin Finck struct rtti_data
914c2c66affSColin Finck {
915c2c66affSColin Finck type_info type_info[4];
916c2c66affSColin Finck
917c2c66affSColin Finck struct _rtti_base_descriptor
918c2c66affSColin Finck {
919c2c66affSColin Finck DEFINE_RTTI_REF(type_info, type_descriptor);
920c2c66affSColin Finck int num_base_classes;
921c2c66affSColin Finck struct {
922c2c66affSColin Finck int this_offset;
923c2c66affSColin Finck int vbase_descr;
924c2c66affSColin Finck int vbase_offset;
925c2c66affSColin Finck } this_ptr_offsets;
926c2c66affSColin Finck unsigned int attributes;
927c2c66affSColin Finck } base_descriptor[4];
928c2c66affSColin Finck
929c2c66affSColin Finck struct _rtti_base_array {
930c2c66affSColin Finck DEFINE_RTTI_REF(struct _rtti_base_descriptor, bases[4]);
931c2c66affSColin Finck } base_array;
932c2c66affSColin Finck
933c2c66affSColin Finck struct _rtti_object_hierarchy {
934c2c66affSColin Finck unsigned int signature;
935c2c66affSColin Finck unsigned int attributes;
936c2c66affSColin Finck int array_len;
937c2c66affSColin Finck DEFINE_RTTI_REF(struct _rtti_base_array, base_classes);
938c2c66affSColin Finck } object_hierarchy;
939c2c66affSColin Finck
940c2c66affSColin Finck struct _object_locator object_locator;
941c2c66affSColin Finck } simple_class_rtti = {
942c2c66affSColin Finck { {NULL, NULL, "simple_class"} },
943c2c66affSColin Finck { {RTTI_REF(simple_class_rtti, type_info[0]), 0, {0, 0, 0}, 0} },
944c2c66affSColin Finck { {RTTI_REF(simple_class_rtti, base_descriptor[0])} },
945c2c66affSColin Finck {0, 0, 1, RTTI_REF(simple_class_rtti, base_array)},
946c2c66affSColin Finck {1, 0, 0, RTTI_REF(simple_class_rtti, type_info[0]), RTTI_REF(simple_class_rtti, object_hierarchy), RTTI_REF(simple_class_rtti, object_locator)}
947c2c66affSColin Finck }, child_class_rtti = {
948c2c66affSColin Finck { {NULL, NULL, "simple_class"}, {NULL, NULL, "child_class"} },
949c2c66affSColin Finck { {RTTI_REF(child_class_rtti, type_info[1]), 0, {4, -1, 0}, 0}, {RTTI_REF(child_class_rtti, type_info[0]), 0, {8, -1, 0}, 0} },
950c2c66affSColin Finck { {RTTI_REF(child_class_rtti, base_descriptor[0]), RTTI_REF(child_class_rtti, base_descriptor[1])} },
951c2c66affSColin Finck {0, 0, 2, RTTI_REF(child_class_rtti, base_array)},
952c2c66affSColin Finck {1, 0, 0, RTTI_REF(child_class_rtti, type_info[1]), RTTI_REF(child_class_rtti, object_hierarchy), RTTI_REF(child_class_rtti, object_locator)}
953c2c66affSColin Finck }, virtual_base_class_rtti = {
954c2c66affSColin Finck { {NULL, NULL, "simple_class"}, {NULL, NULL, "child_class"} },
955c2c66affSColin Finck { {RTTI_REF(virtual_base_class_rtti, type_info[1]), 0, {0x10, sizeof(void*), sizeof(int)}, 0}, {RTTI_REF(virtual_base_class_rtti, type_info[0]), 0, {8, -1, 0}, 0} },
956c2c66affSColin Finck { {RTTI_REF(virtual_base_class_rtti, base_descriptor[0]), RTTI_REF(virtual_base_class_rtti, base_descriptor[1])} },
957c2c66affSColin Finck {0, 0, 2, RTTI_REF(virtual_base_class_rtti, base_array)},
958c2c66affSColin Finck {1, 0, 0, RTTI_REF(virtual_base_class_rtti, type_info[1]), RTTI_REF(virtual_base_class_rtti, object_hierarchy), RTTI_REF(virtual_base_class_rtti, object_locator)}
959c2c66affSColin Finck };
960c2c66affSColin Finck static struct rtti_data simple_class_sig0_rtti, child_class_sig0_rtti;
961c2c66affSColin Finck
962c2c66affSColin Finck void *simple_class_vtbl[2] = {&simple_class_rtti.object_locator};
963c2c66affSColin Finck void *simple_class = &simple_class_vtbl[1];
964c2c66affSColin Finck void *child_class_vtbl[2] = {&child_class_rtti.object_locator};
965c2c66affSColin Finck void *child_class = &child_class_vtbl[1];
966c2c66affSColin Finck void *simple_class_sig0_vtbl[2] = {&simple_class_sig0_rtti.object_locator};
967c2c66affSColin Finck void *simple_class_sig0 = &simple_class_sig0_vtbl[1];
968c2c66affSColin Finck void *child_class_sig0_vtbl[2] = {&child_class_sig0_rtti.object_locator};
969c2c66affSColin Finck void *child_class_sig0 = &child_class_sig0_vtbl[1];
970c2c66affSColin Finck void *virtual_base_class_vtbl[2] = {&virtual_base_class_rtti.object_locator};
971c2c66affSColin Finck int virtual_base_class_vbtbl[2] = {0, 0x100};
972c2c66affSColin Finck struct {
973c2c66affSColin Finck void *virtual_base[2];
974c2c66affSColin Finck char data[0x110-sizeof(void*)];
975c2c66affSColin Finck void *vbthis;
976c2c66affSColin Finck } virtual_base_class = { {&virtual_base_class_vtbl[1], virtual_base_class_vbtbl} };
977c2c66affSColin Finck
978c2c66affSColin Finck static const char* e_name = "name";
979c2c66affSColin Finck type_info *ti,*bti;
980c2c66affSColin Finck exception e,b;
981c2c66affSColin Finck void *casted;
982c2c66affSColin Finck BOOL old_signature;
983c2c66affSColin Finck #ifdef __x86_64__
984c2c66affSColin Finck char *base = (char*)GetModuleHandleW(NULL);
985c2c66affSColin Finck #endif
986c2c66affSColin Finck
987c2c66affSColin Finck if (bAncientVersion ||
988c2c66affSColin Finck !p__RTCastToVoid || !p__RTtypeid || !pexception_ctor || !pbad_typeid_ctor
989c2c66affSColin Finck || !p__RTDynamicCast || !pexception_dtor || !pbad_typeid_dtor)
990c2c66affSColin Finck return;
991c2c66affSColin Finck
992c2c66affSColin Finck call_func2(pexception_ctor, &e, &e_name);
993c2c66affSColin Finck call_func2(pbad_typeid_ctor, &b, e_name);
994c2c66affSColin Finck
995c2c66affSColin Finck obj_locator = get_obj_locator(&e);
996c2c66affSColin Finck if(obj_locator->signature!=1 && sizeof(void*)>sizeof(int))
997c2c66affSColin Finck old_signature = TRUE;
998c2c66affSColin Finck else
999c2c66affSColin Finck old_signature = FALSE;
1000c2c66affSColin Finck
1001c2c66affSColin Finck /* dynamic_cast to void* */
1002c2c66affSColin Finck casted = p__RTCastToVoid(&e);
1003c2c66affSColin Finck ok (casted == (void*)&e, "failed cast to void\n");
1004c2c66affSColin Finck
1005c2c66affSColin Finck /* dynamic_cast up */
1006c2c66affSColin Finck ti = p__RTtypeid(&e);
1007c2c66affSColin Finck bti = p__RTtypeid(&b);
1008c2c66affSColin Finck
1009c2c66affSColin Finck casted = p__RTDynamicCast(&b, 0, NULL, ti, 0);
1010c2c66affSColin Finck if (casted)
1011c2c66affSColin Finck {
1012c2c66affSColin Finck /* New versions do not allow this conversion due to compiler changes */
1013c2c66affSColin Finck ok (casted == (void*)&b, "failed cast from bad_typeid to exception\n");
1014c2c66affSColin Finck }
1015c2c66affSColin Finck
1016c2c66affSColin Finck /* dynamic_cast down */
1017c2c66affSColin Finck casted = p__RTDynamicCast(&e, 0, NULL, bti, 0);
1018c2c66affSColin Finck ok (casted == NULL, "Cast succeeded\n");
1019c2c66affSColin Finck
1020c2c66affSColin Finck call_func1(pexception_dtor, &e);
1021c2c66affSColin Finck call_func1(pbad_typeid_dtor, &b);
1022c2c66affSColin Finck
1023c2c66affSColin Finck simple_class_sig0_rtti = simple_class_rtti;
1024c2c66affSColin Finck simple_class_sig0_rtti.object_locator.signature = 0;
1025c2c66affSColin Finck simple_class_sig0_rtti.base_descriptor[0].type_descriptor = RTTI_REF_SIG0(simple_class_sig0_rtti, type_info[0], base);
1026c2c66affSColin Finck simple_class_sig0_rtti.base_array.bases[0] = RTTI_REF_SIG0(simple_class_sig0_rtti, base_descriptor[0], base);
1027c2c66affSColin Finck simple_class_sig0_rtti.object_hierarchy.base_classes = RTTI_REF_SIG0(simple_class_sig0_rtti, base_array, base);
1028c2c66affSColin Finck simple_class_sig0_rtti.object_locator.type_descriptor = RTTI_REF_SIG0(simple_class_sig0_rtti, type_info[0], base);
1029c2c66affSColin Finck simple_class_sig0_rtti.object_locator.type_hierarchy = RTTI_REF_SIG0(simple_class_sig0_rtti, object_hierarchy, base);
1030c2c66affSColin Finck
1031c2c66affSColin Finck child_class_sig0_rtti = child_class_rtti;
1032c2c66affSColin Finck child_class_sig0_rtti.object_locator.signature = 0;
1033c2c66affSColin Finck child_class_sig0_rtti.base_descriptor[0].type_descriptor = RTTI_REF_SIG0(child_class_sig0_rtti, type_info[1], base);
1034c2c66affSColin Finck child_class_sig0_rtti.base_descriptor[1].type_descriptor = RTTI_REF_SIG0(child_class_sig0_rtti, type_info[0], base);
1035c2c66affSColin Finck child_class_sig0_rtti.base_array.bases[0] = RTTI_REF_SIG0(child_class_sig0_rtti, base_descriptor[0], base);
1036c2c66affSColin Finck child_class_sig0_rtti.base_array.bases[1] = RTTI_REF_SIG0(child_class_sig0_rtti, base_descriptor[1], base);
1037c2c66affSColin Finck child_class_sig0_rtti.object_hierarchy.base_classes = RTTI_REF_SIG0(child_class_sig0_rtti, base_array, base);
1038c2c66affSColin Finck child_class_sig0_rtti.object_locator.type_descriptor = RTTI_REF_SIG0(child_class_sig0_rtti, type_info[1], base);
1039c2c66affSColin Finck child_class_sig0_rtti.object_locator.type_hierarchy = RTTI_REF_SIG0(child_class_sig0_rtti, object_hierarchy, base);
1040c2c66affSColin Finck
1041c2c66affSColin Finck ti = p__RTtypeid(&simple_class_sig0);
1042c2c66affSColin Finck ok (ti && !strcmp(ti->mangled, "simple_class"), "incorrect rtti data\n");
1043c2c66affSColin Finck
1044c2c66affSColin Finck casted = p__RTCastToVoid(&simple_class_sig0);
1045c2c66affSColin Finck ok (casted == (void*)&simple_class_sig0, "failed cast to void\n");
1046c2c66affSColin Finck
1047c2c66affSColin Finck ti = p__RTtypeid(&child_class_sig0);
1048c2c66affSColin Finck ok (ti && !strcmp(ti->mangled, "child_class"), "incorrect rtti data\n");
1049c2c66affSColin Finck
1050c2c66affSColin Finck casted = p__RTCastToVoid(&child_class_sig0);
1051c2c66affSColin Finck ok (casted == (void*)&child_class_sig0, "failed cast to void\n");
1052c2c66affSColin Finck
1053c2c66affSColin Finck casted = p__RTDynamicCast(&child_class_sig0, 0, NULL, simple_class_sig0_rtti.type_info, 0);
1054c2c66affSColin Finck if(casted)
1055c2c66affSColin Finck {
1056c2c66affSColin Finck ok (casted == (char*)&child_class_sig0+8, "failed cast to simple_class (%p %p)\n", casted, &child_class_sig0);
1057c2c66affSColin Finck }
1058c2c66affSColin Finck
1059c2c66affSColin Finck casted = p__RTDynamicCast(&child_class_sig0, 0, &child_class_sig0_rtti.type_info[0], &child_class_sig0_rtti.type_info[1], 0);
1060c2c66affSColin Finck ok(casted == (char*)&child_class_sig0+4, "failed cast to child class (%p %p)\n", casted, &child_class_sig0);
1061c2c66affSColin Finck
1062c2c66affSColin Finck if(old_signature) {
1063c2c66affSColin Finck skip("signature==1 is not supported\n");
1064c2c66affSColin Finck return;
1065c2c66affSColin Finck }
1066c2c66affSColin Finck
1067c2c66affSColin Finck ti = p__RTtypeid(&simple_class);
1068c2c66affSColin Finck ok (ti && !strcmp(ti->mangled, "simple_class"), "incorrect rtti data\n");
1069c2c66affSColin Finck
1070c2c66affSColin Finck casted = p__RTCastToVoid(&simple_class);
1071c2c66affSColin Finck ok (casted == (void*)&simple_class, "failed cast to void\n");
1072c2c66affSColin Finck
1073c2c66affSColin Finck ti = p__RTtypeid(&child_class);
1074c2c66affSColin Finck ok (ti && !strcmp(ti->mangled, "child_class"), "incorrect rtti data\n");
1075c2c66affSColin Finck
1076c2c66affSColin Finck casted = p__RTCastToVoid(&child_class);
1077c2c66affSColin Finck ok (casted == (void*)&child_class, "failed cast to void\n");
1078c2c66affSColin Finck
1079c2c66affSColin Finck casted = p__RTDynamicCast(&child_class, 0, NULL, simple_class_rtti.type_info, 0);
1080c2c66affSColin Finck if(casted)
1081c2c66affSColin Finck {
1082c2c66affSColin Finck ok (casted == (char*)&child_class+8, "failed cast to simple_class (%p %p)\n", casted, &child_class);
1083c2c66affSColin Finck }
1084c2c66affSColin Finck
1085c2c66affSColin Finck casted = p__RTDynamicCast(&child_class, 0, &child_class_rtti.type_info[0], &child_class_rtti.type_info[1], 0);
1086c2c66affSColin Finck ok(casted == (char*)&child_class+4, "failed cast to child class (%p %p)\n", casted, &child_class);
1087c2c66affSColin Finck
1088c2c66affSColin Finck casted = p__RTDynamicCast(&virtual_base_class, 0, &virtual_base_class_rtti.type_info[0], &virtual_base_class_rtti.type_info[1], 0);
1089c2c66affSColin Finck ok(casted == &virtual_base_class.vbthis, "failed cast to child class (%p %p)\n", casted, &virtual_base_class);
1090c2c66affSColin Finck }
1091c2c66affSColin Finck
1092c2c66affSColin Finck struct _demangle {
1093c2c66affSColin Finck LPCSTR mangled;
1094c2c66affSColin Finck LPCSTR result;
1095c2c66affSColin Finck BOOL test_in_wine;
1096c2c66affSColin Finck };
1097c2c66affSColin Finck
test_demangle_datatype(void)1098c2c66affSColin Finck static void test_demangle_datatype(void)
1099c2c66affSColin Finck {
1100c2c66affSColin Finck char * name;
1101c2c66affSColin Finck struct _demangle demangle[]={
1102c2c66affSColin Finck /* { "BlaBla"," ?? ::Bla", FALSE}, */
1103c2c66affSColin Finck { "ABVVec4@ref2@dice@@","class dice::ref2::Vec4 const &",TRUE},
1104c2c66affSColin Finck { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0H@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,7>", TRUE},
1105c2c66affSColin Finck { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HO@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,126>",TRUE},
1106c2c66affSColin Finck { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,2016>",TRUE},
1107c2c66affSColin Finck { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOAA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,32256>",TRUE},
1108c2c66affSColin Finck { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", FALSE},
1109c2c66affSColin Finck /* { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@",FALSE}, */
1110c2c66affSColin Finck };
1111*f446a50fSAmine Khaldi int i, num_test = ARRAY_SIZE(demangle);
1112c2c66affSColin Finck
1113c2c66affSColin Finck for (i = 0; i < num_test; i++)
1114c2c66affSColin Finck {
1115c2c66affSColin Finck name = p__unDName(0, demangle[i].mangled, 0, pmalloc, pfree, 0x2800);
1116c2c66affSColin Finck todo_wine_if (!demangle[i].test_in_wine)
1117c2c66affSColin Finck ok(name != NULL && !strcmp(name,demangle[i].result), "Got name \"%s\" for %d\n", name, i);
1118c2c66affSColin Finck if(name)
1119c2c66affSColin Finck pfree(name);
1120c2c66affSColin Finck }
1121c2c66affSColin Finck }
1122c2c66affSColin Finck
1123c2c66affSColin Finck /* Compare two strings treating multiple spaces (' ', ascii 0x20) in s2
1124c2c66affSColin Finck as single space. Needed for test_demangle as __unDName() returns sometimes
1125c2c66affSColin Finck two spaces instead of one in some older native msvcrt dlls. */
strcmp_space(const char * s1,const char * s2)1126c2c66affSColin Finck static int strcmp_space(const char *s1, const char *s2)
1127c2c66affSColin Finck {
1128c2c66affSColin Finck const char* s2start = s2;
1129c2c66affSColin Finck do {
1130c2c66affSColin Finck while (*s1 == *s2 && *s1) {
1131c2c66affSColin Finck s1++;
1132c2c66affSColin Finck s2++;
1133c2c66affSColin Finck }
1134c2c66affSColin Finck if (*s2 == ' ' && s2 > s2start && *(s2 - 1) == ' ')
1135c2c66affSColin Finck s2++;
1136c2c66affSColin Finck else
1137c2c66affSColin Finck break;
1138c2c66affSColin Finck } while (*s1 && *s2);
1139c2c66affSColin Finck return *s1 - *s2;
1140c2c66affSColin Finck }
1141c2c66affSColin Finck
test_demangle(void)1142c2c66affSColin Finck static void test_demangle(void)
1143c2c66affSColin Finck {
1144c2c66affSColin Finck static struct {const char* in; const char* out; const char *broken; unsigned int flags;} test[] = {
1145c2c66affSColin Finck /* 0 */ {"??0bad_alloc@std@@QAE@ABV01@@Z",
1146c2c66affSColin Finck "public: __thiscall std::bad_alloc::bad_alloc(class std::bad_alloc const &)",
1147c2c66affSColin Finck "public: __thiscall std::bad_alloc::bad_alloc(class bad_alloc::bad_alloc const &)"},
1148c2c66affSColin Finck /* 1 */ {"??0bad_alloc@std@@QAE@PBD@Z",
1149c2c66affSColin Finck "public: __thiscall std::bad_alloc::bad_alloc(char const *)"},
1150c2c66affSColin Finck /* 2 */ {"??0bad_cast@@AAE@PBQBD@Z",
1151c2c66affSColin Finck "private: __thiscall bad_cast::bad_cast(char const * const *)"},
1152c2c66affSColin Finck /* 3 */ {"??0bad_cast@@QAE@ABQBD@Z",
1153c2c66affSColin Finck "public: __thiscall bad_cast::bad_cast(char const * const &)"},
1154c2c66affSColin Finck /* 4 */ {"??0bad_cast@@QAE@ABV0@@Z",
1155c2c66affSColin Finck "public: __thiscall bad_cast::bad_cast(class bad_cast const &)"},
1156c2c66affSColin Finck /* 5 */ {"??0bad_exception@std@@QAE@ABV01@@Z",
1157c2c66affSColin Finck "public: __thiscall std::bad_exception::bad_exception(class std::bad_exception const &)",
1158c2c66affSColin Finck "public: __thiscall std::bad_exception::bad_exception(class bad_exception::bad_exception const &)"},
1159c2c66affSColin Finck /* 6 */ {"??0bad_exception@std@@QAE@PBD@Z",
1160c2c66affSColin Finck "public: __thiscall std::bad_exception::bad_exception(char const *)"},
1161c2c66affSColin Finck /* 7 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@ABV01@@Z",
1162c2c66affSColin Finck "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(class std::basic_filebuf<char,struct std::char_traits<char> > const &)",
1163c2c66affSColin Finck "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(class basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> > const &)"},
1164c2c66affSColin Finck /* 8 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z",
1165c2c66affSColin Finck "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(struct _iobuf *)"},
1166c2c66affSColin Finck /* 9 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z",
1167c2c66affSColin Finck "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(enum std::_Uninitialized)",
1168c2c66affSColin Finck "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(enum basic_filebuf<char,struct std::char_traits<char> >::_Uninitialized)"},
1169c2c66affSColin Finck /* 10 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@ABV01@@Z",
1170c2c66affSColin Finck "public: __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >(class std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> > const &)",
1171c2c66affSColin Finck "public: __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >(class basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> > const &)"},
1172c2c66affSColin Finck /* 11 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z",
1173c2c66affSColin Finck "public: __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >(struct _iobuf *)"},
1174c2c66affSColin Finck /* 12 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z",
1175c2c66affSColin Finck "public: __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >(enum std::_Uninitialized)",
1176c2c66affSColin Finck "public: __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >(enum basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::_Uninitialized)"},
1177c2c66affSColin Finck /* 13 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z",
1178c2c66affSColin Finck "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > const &)",
1179c2c66affSColin Finck "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(class basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1180c2c66affSColin Finck /* 14 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z",
1181c2c66affSColin Finck "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)",
1182c2c66affSColin Finck "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(class basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)"},
1183c2c66affSColin Finck /* 15 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z",
1184c2c66affSColin Finck "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(int)"},
1185c2c66affSColin Finck /* 16 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV01@@Z",
1186c2c66affSColin Finck "public: __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(class std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)",
1187c2c66affSColin Finck "public: __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(class basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1188c2c66affSColin Finck /* 17 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z",
1189c2c66affSColin Finck "public: __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,int)",
1190c2c66affSColin Finck "public: __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(class basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,int)"},
1191c2c66affSColin Finck /* 18 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z",
1192c2c66affSColin Finck "public: __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(int)"},
1193c2c66affSColin Finck /* 19 */ {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z",
1194c2c66affSColin Finck "public: __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >(class std::_Locinfo const &,unsigned int)",
1195c2c66affSColin Finck "public: __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >(class num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::_Locinfo const &,unsigned int)"},
1196c2c66affSColin Finck /* 20 */ {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z",
1197c2c66affSColin Finck "public: __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >(unsigned int)"},
1198c2c66affSColin Finck /* 21 */ {"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z",
1199c2c66affSColin Finck "public: __thiscall std::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >(class std::_Locinfo const &,unsigned int)",
1200c2c66affSColin Finck "public: __thiscall std::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >(class num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >::_Locinfo const &,unsigned int)"},
1201c2c66affSColin Finck /* 22 */ {"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z", "public: __thiscall std::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >(unsigned int)"},
1202c2c66affSColin Finck /* 23 */ {"??0streambuf@@QAE@ABV0@@Z", "public: __thiscall streambuf::streambuf(class streambuf const &)"},
1203c2c66affSColin Finck /* 24 */ {"??0strstreambuf@@QAE@ABV0@@Z", "public: __thiscall strstreambuf::strstreambuf(class strstreambuf const &)"},
1204c2c66affSColin Finck /* 25 */ {"??0strstreambuf@@QAE@H@Z", "public: __thiscall strstreambuf::strstreambuf(int)"},
1205c2c66affSColin Finck /* 26 */ {"??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z", "public: __thiscall strstreambuf::strstreambuf(void * (__cdecl*)(long),void (__cdecl*)(void *))"},
1206c2c66affSColin Finck /* 27 */ {"??0strstreambuf@@QAE@PADH0@Z", "public: __thiscall strstreambuf::strstreambuf(char *,int,char *)"},
1207c2c66affSColin Finck /* 28 */ {"??0strstreambuf@@QAE@PAEH0@Z", "public: __thiscall strstreambuf::strstreambuf(unsigned char *,int,unsigned char *)"},
1208c2c66affSColin Finck /* 29 */ {"??0strstreambuf@@QAE@XZ", "public: __thiscall strstreambuf::strstreambuf(void)"},
1209c2c66affSColin Finck /* 30 */ {"??1__non_rtti_object@std@@UAE@XZ", "public: virtual __thiscall std::__non_rtti_object::~__non_rtti_object(void)"},
1210c2c66affSColin Finck /* 31 */ {"??1__non_rtti_object@@UAE@XZ", "public: virtual __thiscall __non_rtti_object::~__non_rtti_object(void)"},
1211c2c66affSColin Finck /* 32 */ {"??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ", "public: virtual __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::~num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >(void)"},
1212c2c66affSColin Finck /* 33 */ {"??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ", "public: virtual __thiscall std::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >::~num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >(void)"},
1213c2c66affSColin Finck /* 34 */ {"??4istream_withassign@@QAEAAV0@ABV0@@Z", "public: class istream_withassign & __thiscall istream_withassign::operator=(class istream_withassign const &)"},
1214c2c66affSColin Finck /* 35 */ {"??4istream_withassign@@QAEAAVistream@@ABV1@@Z", "public: class istream & __thiscall istream_withassign::operator=(class istream const &)"},
1215c2c66affSColin Finck /* 36 */ {"??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z", "public: class istream & __thiscall istream_withassign::operator=(class streambuf *)"},
1216c2c66affSColin Finck /* 37 */ {"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAC@Z", "class std::basic_istream<char,struct std::char_traits<char> > & __cdecl std::operator>>(class std::basic_istream<char,struct std::char_traits<char> > &,signed char &)"},
1217c2c66affSColin Finck /* 38 */ {"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAD@Z", "class std::basic_istream<char,struct std::char_traits<char> > & __cdecl std::operator>>(class std::basic_istream<char,struct std::char_traits<char> > &,char &)"},
1218c2c66affSColin Finck /* 39 */ {"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAE@Z", "class std::basic_istream<char,struct std::char_traits<char> > & __cdecl std::operator>>(class std::basic_istream<char,struct std::char_traits<char> > &,unsigned char &)"},
1219c2c66affSColin Finck /* 40 */ {"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z", "public: class std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> > & __thiscall std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> >::operator<<(class std::ios_base & (__cdecl*)(class std::ios_base &))"},
1220c2c66affSColin Finck /* 41 */ {"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z", "public: class std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> > & __thiscall std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> >::operator<<(class std::basic_streambuf<unsigned short,struct std::char_traits<unsigned short> > *)"},
1221c2c66affSColin Finck /* 42 */ {"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PBX@Z", "public: class std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> > & __thiscall std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> >::operator<<(void const *)"},
1222c2c66affSColin Finck /* 43 */ {"??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@", "const std::basic_fstream<char,struct std::char_traits<char> >::`vbtable'{for `std::basic_ostream<char,struct std::char_traits<char> >'}"},
1223c2c66affSColin Finck /* 44 */ {"??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@", "const std::basic_fstream<unsigned short,struct std::char_traits<unsigned short> >::`vbtable'{for `std::basic_istream<unsigned short,struct std::char_traits<unsigned short> >'}"},
1224c2c66affSColin Finck /* 45 */ {"??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@", "const std::basic_fstream<unsigned short,struct std::char_traits<unsigned short> >::`vbtable'{for `std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> >'}"},
1225c2c66affSColin Finck /* 46 */ {"??9std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z", "bool __cdecl std::operator!=(char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1226c2c66affSColin Finck /* 47 */ {"??9std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z", "bool __cdecl std::operator!=(unsigned short const *,class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1227c2c66affSColin Finck /* 48 */ {"??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAADI@Z", "public: char & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator[](unsigned int)"},
1228c2c66affSColin Finck /* 49 */ {"??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDI@Z", "public: char const & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator[](unsigned int)const "},
1229c2c66affSColin Finck /* 50 */ {"??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAGI@Z", "public: unsigned short & __thiscall std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::operator[](unsigned int)"},
1230c2c66affSColin Finck /* 51 */ {"??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEABGI@Z", "public: unsigned short const & __thiscall std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::operator[](unsigned int)const "},
1231c2c66affSColin Finck /* 52 */ {"?abs@std@@YAMABV?$complex@M@1@@Z", "float __cdecl std::abs(class std::complex<float> const &)"},
1232c2c66affSColin Finck /* 53 */ {"?abs@std@@YANABV?$complex@N@1@@Z", "double __cdecl std::abs(class std::complex<double> const &)"},
1233c2c66affSColin Finck /* 54 */ {"?abs@std@@YAOABV?$complex@O@1@@Z", "long double __cdecl std::abs(class std::complex<long double> const &)"},
1234c2c66affSColin Finck /* 55 */ {"?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A", "class std::basic_istream<char,struct std::char_traits<char> > std::cin"},
1235c2c66affSColin Finck /* 56 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAG@Z", "protected: virtual class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,unsigned short &)const "},
1236c2c66affSColin Finck /* 57 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAI@Z", "protected: virtual class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,unsigned int &)const "},
1237c2c66affSColin Finck /* 58 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z", "protected: virtual class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,long &)const "},
1238c2c66affSColin Finck /* 59 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAK@Z", "protected: virtual class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,unsigned long &)const "},
1239c2c66affSColin Finck /* 60 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAM@Z", "protected: virtual class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,float &)const "},
1240c2c66affSColin Finck /* 61 */ {"?_query_new_handler@@YAP6AHI@ZXZ", "int (__cdecl*__cdecl _query_new_handler(void))(unsigned int)"},
1241c2c66affSColin Finck /* 62 */ {"?register_callback@ios_base@std@@QAEXP6AXW4event@12@AAV12@H@ZH@Z", "public: void __thiscall std::ios_base::register_callback(void (__cdecl*)(enum std::ios_base::event,class std::ios_base &,int),int)"},
1242c2c66affSColin Finck /* 63 */ {"?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@JW4seekdir@ios_base@2@@Z", "public: class std::basic_istream<char,struct std::char_traits<char> > & __thiscall std::basic_istream<char,struct std::char_traits<char> >::seekg(long,enum std::ios_base::seekdir)"},
1243c2c66affSColin Finck /* 64 */ {"?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z", "public: class std::basic_istream<char,struct std::char_traits<char> > & __thiscall std::basic_istream<char,struct std::char_traits<char> >::seekg(class std::fpos<int>)"},
1244c2c66affSColin Finck /* 65 */ {"?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@JW4seekdir@ios_base@2@@Z", "public: class std::basic_istream<unsigned short,struct std::char_traits<unsigned short> > & __thiscall std::basic_istream<unsigned short,struct std::char_traits<unsigned short> >::seekg(long,enum std::ios_base::seekdir)"},
1245c2c66affSColin Finck /* 66 */ {"?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z", "public: class std::basic_istream<unsigned short,struct std::char_traits<unsigned short> > & __thiscall std::basic_istream<unsigned short,struct std::char_traits<unsigned short> >::seekg(class std::fpos<int>)"},
1246c2c66affSColin Finck /* 67 */ {"?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JW4seekdir@ios_base@2@H@Z", "protected: virtual class std::fpos<int> __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::seekoff(long,enum std::ios_base::seekdir,int)"},
1247c2c66affSColin Finck /* 68 */ {"?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JW4seekdir@ios_base@2@H@Z", "protected: virtual class std::fpos<int> __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::seekoff(long,enum std::ios_base::seekdir,int)"},
1248c2c66affSColin Finck /* 69 */ {"?set_new_handler@@YAP6AXXZP6AXXZ@Z", "void (__cdecl*__cdecl set_new_handler(void (__cdecl*)(void)))(void)"},
1249c2c66affSColin Finck /* 70 */ {"?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_istringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1250c2c66affSColin Finck /* 71 */ {"?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_istringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const "},
1251c2c66affSColin Finck /* 72 */ {"?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_istringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1252c2c66affSColin Finck /* 73 */ {"?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > __thiscall std::basic_istringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(void)const "},
1253c2c66affSColin Finck /* 74 */ {"?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1254c2c66affSColin Finck /* 75 */ {"?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const "},
1255c2c66affSColin Finck /* 76 */ {"?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_ostringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1256c2c66affSColin Finck /* 77 */ {"?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > __thiscall std::basic_ostringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(void)const "},
1257c2c66affSColin Finck /* 78 */ {"?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class std::allocator<char> >::str(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1258c2c66affSColin Finck /* 79 */ {"?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const "},
1259c2c66affSColin Finck /* 80 */ {"?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_stringbuf<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1260c2c66affSColin Finck /* 81 */ {"?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > __thiscall std::basic_stringbuf<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(void)const "},
1261c2c66affSColin Finck /* 82 */ {"?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1262c2c66affSColin Finck /* 83 */ {"?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const "},
1263c2c66affSColin Finck /* 84 */ {"?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1264c2c66affSColin Finck /* 85 */ {"?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(void)const "},
1265c2c66affSColin Finck /* 86 */ {"?_Sync@ios_base@std@@0_NA", "private: static bool std::ios_base::_Sync"},
1266c2c66affSColin Finck /* 87 */ {"??_U@YAPAXI@Z", "void * __cdecl operator new[](unsigned int)"},
1267c2c66affSColin Finck /* 88 */ {"??_V@YAXPAX@Z", "void __cdecl operator delete[](void *)"},
1268c2c66affSColin Finck /* 89 */ {"??X?$_Complex_base@M@std@@QAEAAV01@ABM@Z", "public: class std::_Complex_base<float> & __thiscall std::_Complex_base<float>::operator*=(float const &)"},
1269c2c66affSColin Finck /* 90 */ {"??Xstd@@YAAAV?$complex@M@0@AAV10@ABV10@@Z", "class std::complex<float> & __cdecl std::operator*=(class std::complex<float> &,class std::complex<float> const &)"},
1270c2c66affSColin Finck /* 91 */ {"?aaa@@YAHAAUbbb@@@Z", "int __cdecl aaa(struct bbb &)"},
1271c2c66affSColin Finck /* 92 */ {"?aaa@@YAHBAUbbb@@@Z", "int __cdecl aaa(struct bbb & volatile)"},
1272c2c66affSColin Finck /* 93 */ {"?aaa@@YAHPAUbbb@@@Z", "int __cdecl aaa(struct bbb *)"},
1273c2c66affSColin Finck /* 94 */ {"?aaa@@YAHQAUbbb@@@Z", "int __cdecl aaa(struct bbb * const)"},
1274c2c66affSColin Finck /* 95 */ {"?aaa@@YAHRAUbbb@@@Z", "int __cdecl aaa(struct bbb * volatile)"},
1275c2c66affSColin Finck /* 96 */ {"?aaa@@YAHSAUbbb@@@Z", "int __cdecl aaa(struct bbb * const volatile)"},
1276c2c66affSColin Finck /* 97 */ {"??0aa.a@@QAE@XZ", "??0aa.a@@QAE@XZ"},
1277c2c66affSColin Finck /* 98 */ {"??0aa$_3a@@QAE@XZ", "public: __thiscall aa$_3a::aa$_3a(void)"},
1278c2c66affSColin Finck /* 99 */ {"??2?$aaa@AAUbbb@@AAUccc@@AAU2@@ddd@1eee@2@QAEHXZ", "public: int __thiscall eee::eee::ddd::ddd::aaa<struct bbb &,struct ccc &,struct ccc &>::operator new(void)"},
1279c2c66affSColin Finck /* 100 */ {"?pSW@@3P6GHKPAX0PAU_tagSTACKFRAME@@0P6GH0K0KPAK@ZP6GPAX0K@ZP6GK0K@ZP6GK00PAU_tagADDRESS@@@Z@ZA", "int (__stdcall* pSW)(unsigned long,void *,void *,struct _tagSTACKFRAME *,void *,int (__stdcall*)(void *,unsigned long,void *,unsigned long,unsigned long *),void * (__stdcall*)(void *,unsigned long),unsigned long (__stdcall*)(void *,unsigned long),unsigned long (__stdcall*)(void *,void *,struct _tagADDRESS *))"},
1280c2c66affSColin Finck /* 101 */ {"?$_aaa@Vbbb@@", "_aaa<class bbb>"},
1281c2c66affSColin Finck /* 102 */ {"?$aaa@Vbbb@ccc@@Vddd@2@", "aaa<class ccc::bbb,class ccc::ddd>"},
1282c2c66affSColin Finck /* 103 */ { "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "public: __thiscall Foo<int (__stdcall*)(void *,void *)>::Foo<int (__stdcall*)(void *,void *)>(char *)"},
1283c2c66affSColin Finck /* 104 */ { "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "__thiscall Foo<int (__stdcall*)(void *,void *)>::Foo<int (__stdcall*)(void *,void *)>(char *)", NULL, 0x880},
1284c2c66affSColin Finck /* 105 */ { "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "private: static int (__cdecl** Bar::Qux)(class Bar *,int &,int &,int *)" },
1285c2c66affSColin Finck /* 106 */ { "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "Bar::Qux", NULL, 0x1800},
1286c2c66affSColin Finck /* 107 */ {"?$AAA@$DBAB@", "AAA<`template-parameter257'>"},
1287c2c66affSColin Finck /* 108 */ {"?$AAA@?C@", "AAA<`template-parameter-2'>"},
1288c2c66affSColin Finck /* 109 */ {"?$AAA@PAUBBB@@", "AAA<struct BBB *>"},
1289c2c66affSColin Finck /* 110 */ {"??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z",
1290c2c66affSColin Finck "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa * *,class ee *)",
1291c2c66affSColin Finck "??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z"},
1292c2c66affSColin Finck /* 111 */ {"?f@T@@QAEHQCY1BE@BO@D@Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"},
1293c2c66affSColin Finck /* 112 */ {"?f@T@@QAEHQAY2BE@BO@CI@D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"},
1294c2c66affSColin Finck /* 113 */ {"?f@T@@QAEHQAY1BE@BO@$$CBD@Z", "public: int __thiscall T::f(char const (* const)[20][30])"},
1295c2c66affSColin Finck /* 114 */ {"??0?$Foo@U?$vector_c@H$00$01$0?1$0A@$0A@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@@mpl@boost@@@@QAE@XZ",
1296c2c66affSColin Finck "public: __thiscall Foo<struct boost::mpl::vector_c<int,1,2,-2,0,0,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647> >::Foo<struct boost::mpl::vector_c<int,1,2,-2,0,0,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647> >(void)"},
1297c2c66affSColin Finck /* 115 */ {"?swprintf@@YAHPAGIPBGZZ", "int __cdecl swprintf(unsigned short *,unsigned int,unsigned short const *,...)"},
1298c2c66affSColin Finck /* 116 */ {"?vswprintf@@YAHPAGIPBGPAD@Z", "int __cdecl vswprintf(unsigned short *,unsigned int,unsigned short const *,char *)"},
1299c2c66affSColin Finck /* 117 */ {"?vswprintf@@YAHPA_WIPB_WPAD@Z", "int __cdecl vswprintf(wchar_t *,unsigned int,wchar_t const *,char *)"},
1300c2c66affSColin Finck /* 118 */ {"?swprintf@@YAHPA_WIPB_WZZ", "int __cdecl swprintf(wchar_t *,unsigned int,wchar_t const *,...)"},
1301c2c66affSColin Finck /* 119 */ {"??Xstd@@YAAEAV?$complex@M@0@AEAV10@AEBV10@@Z", "class std::complex<float> & __ptr64 __cdecl std::operator*=(class std::complex<float> & __ptr64,class std::complex<float> const & __ptr64)"},
1302c2c66affSColin Finck /* 120 */ {"?_Doraise@bad_cast@std@@MEBAXXZ", "protected: virtual void __cdecl std::bad_cast::_Doraise(void)const __ptr64"},
1303c2c66affSColin Finck /* 121 */ {"??$?DM@std@@YA?AV?$complex@M@0@ABMABV10@@Z",
1304c2c66affSColin Finck "class std::complex<float> __cdecl std::operator*<float>(float const &,class std::complex<float> const &)",
1305c2c66affSColin Finck "??$?DM@std@@YA?AV?$complex@M@0@ABMABV10@@Z"},
1306c2c66affSColin Finck /* 122 */ {"?_R2@?BN@???$_Fabs@N@std@@YANAEBV?$complex@N@1@PEAH@Z@4NB",
1307c2c66affSColin Finck "double const `double __cdecl std::_Fabs<double>(class std::complex<double> const & __ptr64,int * __ptr64)'::`29'::_R2",
1308c2c66affSColin Finck "?_R2@?BN@???$_Fabs@N@std@@YANAEBV?$complex@N@1@PEAH@Z@4NB"},
1309c2c66affSColin Finck /* 123 */ {"?vtordisp_thunk@std@@$4PPPPPPPM@3EAA_NXZ",
1310c2c66affSColin Finck "[thunk]:public: virtual bool __cdecl std::vtordisp_thunk`vtordisp{4294967292,4}' (void) __ptr64",
1311c2c66affSColin Finck "[thunk]:public: virtual bool __cdecl std::vtordisp_thunk`vtordisp{-4,4}' (void) __ptr64"},
1312c2c66affSColin Finck /* 124 */ {"??_9CView@@$BBII@AE",
1313c2c66affSColin Finck "[thunk]: __thiscall CView::`vcall'{392,{flat}}' }'",
1314c2c66affSColin Finck "[thunk]: __thiscall CView::`vcall'{392,{flat}}' "},
1315c2c66affSColin Finck /* 125 */ {"?_dispatch@_impl_Engine@SalomeApp@@$R4CE@BA@PPPPPPPM@7AE_NAAVomniCallHandle@@@Z",
1316c2c66affSColin Finck "[thunk]:public: virtual bool __thiscall SalomeApp::_impl_Engine::_dispatch`vtordispex{36,16,4294967292,8}' (class omniCallHandle &)",
1317c2c66affSColin Finck "?_dispatch@_impl_Engine@SalomeApp@@$R4CE@BA@PPPPPPPM@7AE_NAAVomniCallHandle@@@Z"},
1318c2c66affSColin Finck /* 126 */ {"?_Doraise@bad_cast@std@@MEBAXXZ", "protected: virtual void __cdecl std::bad_cast::_Doraise(void)", NULL, 0x60},
1319c2c66affSColin Finck /* 127 */ {"??Xstd@@YAAEAV?$complex@M@0@AEAV10@AEBV10@@Z", "class std::complex<float> & ptr64 cdecl std::operator*=(class std::complex<float> & ptr64,class std::complex<float> const & ptr64)", NULL, 1},
1320c2c66affSColin Finck /* 128 */ {"??Xstd@@YAAEAV?$complex@M@0@AEAV10@AEBV10@@Z",
1321c2c66affSColin Finck "class std::complex<float> & std::operator*=(class std::complex<float> &,class std::complex<float> const &)",
1322c2c66affSColin Finck "??Xstd@@YAAEAV?$complex@M@0@AEAV10@AEBV10@@Z", 2},
1323c2c66affSColin Finck /* 129 */ {"??$run@XVTask_Render_Preview@@@QtConcurrent@@YA?AV?$QFuture@X@@PEAVTask_Render_Preview@@P82@EAAXXZ@Z",
1324c2c66affSColin Finck "class QFuture<void> __cdecl QtConcurrent::run<void,class Task_Render_Preview>(class Task_Render_Preview * __ptr64,void (__cdecl Task_Render_Preview::*)(void) __ptr64)",
1325c2c66affSColin Finck "??$run@XVTask_Render_Preview@@@QtConcurrent@@YA?AV?$QFuture@X@@PEAVTask_Render_Preview@@P82@EAAXXZ@Z"},
1326c2c66affSColin Finck /* 130 */ {"??_E?$TStrArray@$$BY0BAA@D$0BA@@@UAEPAXI@Z",
1327c2c66affSColin Finck "public: virtual void * __thiscall TStrArray<char [256],16>::`vector deleting destructor'(unsigned int)"},
1328c2c66affSColin Finck };
1329*f446a50fSAmine Khaldi int i, num_test = ARRAY_SIZE(test);
1330c2c66affSColin Finck char* name;
1331c2c66affSColin Finck
1332c2c66affSColin Finck for (i = 0; i < num_test; i++)
1333c2c66affSColin Finck {
1334c2c66affSColin Finck name = p__unDName(0, test[i].in, 0, pmalloc, pfree, test[i].flags);
1335c2c66affSColin Finck ok(name != NULL, "%u: unDName failed\n", i);
1336c2c66affSColin Finck if (!name) continue;
1337c2c66affSColin Finck ok( !strcmp_space(test[i].out, name) ||
1338c2c66affSColin Finck broken(test[i].broken && !strcmp_space(test[i].broken, name)),
1339c2c66affSColin Finck "%u: Got name \"%s\"\n", i, name );
1340c2c66affSColin Finck ok( !strcmp_space(test[i].out, name) ||
1341c2c66affSColin Finck broken(test[i].broken && !strcmp_space(test[i].broken, name)),
1342c2c66affSColin Finck "%u: Expected \"%s\"\n", i, test[i].out );
1343c2c66affSColin Finck pfree(name);
1344c2c66affSColin Finck }
1345c2c66affSColin Finck }
1346c2c66affSColin Finck
START_TEST(cpp)1347c2c66affSColin Finck START_TEST(cpp)
1348c2c66affSColin Finck {
1349c2c66affSColin Finck if (!InitFunctionPtrs())
1350c2c66affSColin Finck return;
1351c2c66affSColin Finck
1352c2c66affSColin Finck test_exception();
1353c2c66affSColin Finck test_bad_typeid();
1354c2c66affSColin Finck test_bad_cast();
1355c2c66affSColin Finck test___non_rtti_object();
1356c2c66affSColin Finck test_type_info();
1357c2c66affSColin Finck test_rtti();
1358c2c66affSColin Finck test_demangle_datatype();
1359c2c66affSColin Finck test_demangle();
1360c2c66affSColin Finck }
1361