1 /* Unit test suite for msvcrt C++ objects
3 * Copyright 2003 Jon Griffiths
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * This tests is only valid for ix86 platforms, on others it's a no-op.
21 * Some tests cannot be checked with ok(), for example the dtors. We simply
22 * call them to ensure we don't crash ;-)
24 * If we build this test with VC++ in debug mode, we will fail in _chkstk()
25 * or at program exit malloc() checking if these methods haven't been
26 * implemented correctly (they have).
28 * Tested with a range of native msvcrt's from v4 -> v7.
30 #include "wine/test.h"
35 /* Skip these tests for non x86 platforms */
41 typedef struct __exception
48 typedef struct __type_info
55 /* Function pointers. We need to use these to call these funcs as __thiscall */
56 static HMODULE hMsvcrt;
58 static void* (*poperator_new)(unsigned int);
59 static void (*poperator_delete)(void*);
60 static void* (*pmalloc)(unsigned int);
61 static void (*pfree)(void*);
64 static void (WINAPI *pexception_ctor)(exception*,LPCSTR*);
65 static void (WINAPI *pexception_copy_ctor)(exception*,exception*);
66 static void (WINAPI *pexception_default_ctor)(exception*);
67 static void (WINAPI *pexception_dtor)(exception*);
68 static exception* (WINAPI *pexception_opequals)(exception*,exception*);
69 static char* (WINAPI *pexception_what)(exception*);
70 static void* (WINAPI *pexception_vtable)(exception*);
71 static void (WINAPI *pexception_vector_dtor)(exception*,unsigned int);
72 static void (WINAPI *pexception_scalar_dtor)(exception*,unsigned int);
75 static void (WINAPI *pbad_typeid_ctor)(exception*,LPCSTR);
76 static void (WINAPI *pbad_typeid_ctor_closure)(exception*);
77 static void (WINAPI *pbad_typeid_copy_ctor)(exception*,exception*);
78 static void (WINAPI *pbad_typeid_dtor)(exception*);
79 static exception* (WINAPI *pbad_typeid_opequals)(exception*,exception*);
80 static char* (WINAPI *pbad_typeid_what)(exception*);
81 static void* (WINAPI *pbad_typeid_vtable)(exception*);
82 static void (WINAPI *pbad_typeid_vector_dtor)(exception*,unsigned int);
83 static void (WINAPI *pbad_typeid_scalar_dtor)(exception*,unsigned int);
86 static void (WINAPI *pbad_cast_ctor)(exception*,LPCSTR*);
87 static void (WINAPI *pbad_cast_ctor2)(exception*,LPCSTR);
88 static void (WINAPI *pbad_cast_ctor_closure)(exception*);
89 static void (WINAPI *pbad_cast_copy_ctor)(exception*,exception*);
90 static void (WINAPI *pbad_cast_dtor)(exception*);
91 static exception* (WINAPI *pbad_cast_opequals)(exception*,exception*);
92 static char* (WINAPI *pbad_cast_what)(exception*);
93 static void* (WINAPI *pbad_cast_vtable)(exception*);
94 static void (WINAPI *pbad_cast_vector_dtor)(exception*,unsigned int);
95 static void (WINAPI *pbad_cast_scalar_dtor)(exception*,unsigned int);
97 /* __non_rtti_object */
98 static void (WINAPI *p__non_rtti_object_ctor)(exception*,LPCSTR);
99 static void (WINAPI *p__non_rtti_object_copy_ctor)(exception*,exception*);
100 static void (WINAPI *p__non_rtti_object_dtor)(exception*);
101 static exception* (WINAPI *p__non_rtti_object_opequals)(exception*,exception*);
102 static char* (WINAPI *p__non_rtti_object_what)(exception*);
103 static void* (WINAPI *p__non_rtti_object_vtable)(exception*);
104 static void (WINAPI *p__non_rtti_object_vector_dtor)(exception*,unsigned int);
105 static void (WINAPI *p__non_rtti_object_scalar_dtor)(exception*,unsigned int);
108 static void (WINAPI *ptype_info_dtor)(type_info*);
109 static char* (WINAPI *ptype_info_raw_name)(type_info*);
110 static char* (WINAPI *ptype_info_name)(type_info*);
111 static int (WINAPI *ptype_info_before)(type_info*,type_info*);
112 static int (WINAPI *ptype_info_opequals_equals)(type_info*,type_info*);
113 static int (WINAPI *ptype_info_opnot_equals)(type_info*,type_info*);
116 static type_info* (*p__RTtypeid)(void*);
117 static void* (*p__RTCastToVoid)(void*);
118 static void* (*p__RTDynamicCast)(void*,int,void*,void*,int);
121 static char* (*p__unDName)(char*,const char*,int,void*,void*,unsigned short int);
124 /* _very_ early native versions have serious RTTI bugs, so we check */
125 static void* bAncientVersion;
127 /* Emulate a __thiscall */
129 inline static void* do_call_func1(void *func, void *_this)
131 volatile void* retval = 0;
140 return (void*)retval;
143 inline static void* do_call_func2(void *func, void *_this, void* arg)
145 volatile void* retval = 0;
155 return (void*)retval;
158 static void* do_call_func1(void *func, void *_this)
161 __asm__ __volatile__ ("call *%1"
163 : "g" (func), "c" (_this)
167 static void* do_call_func2(void *func, void *_this, void* arg)
170 __asm__ __volatile__ ("pushl %2\n\tcall *%1"
172 : "r" (func), "g" (arg), "c" (_this)
178 #define call_func1(x,y) do_call_func1((void*)x,(void*)y)
179 #define call_func2(x,y,z) do_call_func2((void*)x,(void*)y,(void*)z)
181 /* Some exports are only available in later versions */
182 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
183 #define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
185 static void InitFunctionPtrs(void)
187 hMsvcrt = LoadLibraryA("msvcrt.dll");
188 ok(hMsvcrt != 0, "LoadLibraryA failed\n");
191 SETNOFAIL(poperator_new, "??_U@YAPAXI@Z");
192 SETNOFAIL(poperator_delete, "??_V@YAXPAX@Z");
193 SET(pmalloc, "malloc");
197 poperator_new = pmalloc;
198 if (!poperator_delete)
199 poperator_delete = pfree;
201 SET(pexception_ctor, "??0exception@@QAE@ABQBD@Z");
202 SET(pexception_copy_ctor, "??0exception@@QAE@ABV0@@Z");
203 SET(pexception_default_ctor, "??0exception@@QAE@XZ");
204 SET(pexception_dtor, "??1exception@@UAE@XZ");
205 SET(pexception_opequals, "??4exception@@QAEAAV0@ABV0@@Z");
206 SET(pexception_what, "?what@exception@@UBEPBDXZ");
207 SET(pexception_vtable, "??_7exception@@6B@");
208 SET(pexception_vector_dtor, "??_Eexception@@UAEPAXI@Z");
209 SET(pexception_scalar_dtor, "??_Gexception@@UAEPAXI@Z");
211 SET(pbad_typeid_ctor, "??0bad_typeid@@QAE@PBD@Z");
212 SETNOFAIL(pbad_typeid_ctor_closure, "??_Fbad_typeid@@QAEXXZ");
213 SET(pbad_typeid_copy_ctor, "??0bad_typeid@@QAE@ABV0@@Z");
214 SET(pbad_typeid_dtor, "??1bad_typeid@@UAE@XZ");
215 SET(pbad_typeid_opequals, "??4bad_typeid@@QAEAAV0@ABV0@@Z");
216 SET(pbad_typeid_what, "?what@exception@@UBEPBDXZ");
217 SET(pbad_typeid_vtable, "??_7bad_typeid@@6B@");
218 SET(pbad_typeid_vector_dtor, "??_Ebad_typeid@@UAEPAXI@Z");
219 SET(pbad_typeid_scalar_dtor, "??_Gbad_typeid@@UAEPAXI@Z");
221 SETNOFAIL(pbad_cast_ctor, "??0bad_cast@@QAE@ABQBD@Z");
223 SET(pbad_cast_ctor, "??0bad_cast@@AAE@PBQBD@Z");
224 SETNOFAIL(pbad_cast_ctor2, "??0bad_cast@@QAE@PBD@Z");
225 SETNOFAIL(pbad_cast_ctor_closure, "??_Fbad_cast@@QAEXXZ");
226 SET(pbad_cast_copy_ctor, "??0bad_cast@@QAE@ABV0@@Z");
227 SET(pbad_cast_dtor, "??1bad_cast@@UAE@XZ");
228 SET(pbad_cast_opequals, "??4bad_cast@@QAEAAV0@ABV0@@Z");
229 SET(pbad_cast_what, "?what@exception@@UBEPBDXZ");
230 SET(pbad_cast_vtable, "??_7bad_cast@@6B@");
231 SET(pbad_cast_vector_dtor, "??_Ebad_cast@@UAEPAXI@Z");
232 SET(pbad_cast_scalar_dtor, "??_Gbad_cast@@UAEPAXI@Z");
234 SET(p__non_rtti_object_ctor, "??0__non_rtti_object@@QAE@PBD@Z");
235 SET(p__non_rtti_object_copy_ctor, "??0__non_rtti_object@@QAE@ABV0@@Z");
236 SET(p__non_rtti_object_dtor, "??1__non_rtti_object@@UAE@XZ");
237 SET(p__non_rtti_object_opequals, "??4__non_rtti_object@@QAEAAV0@ABV0@@Z");
238 SET(p__non_rtti_object_what, "?what@exception@@UBEPBDXZ");
239 SET(p__non_rtti_object_vtable, "??_7__non_rtti_object@@6B@");
240 SET(p__non_rtti_object_vector_dtor, "??_E__non_rtti_object@@UAEPAXI@Z");
241 SET(p__non_rtti_object_scalar_dtor, "??_G__non_rtti_object@@UAEPAXI@Z");
243 SET(ptype_info_dtor, "??1type_info@@UAE@XZ");
244 SET(ptype_info_raw_name, "?raw_name@type_info@@QBEPBDXZ");
245 SET(ptype_info_name, "?name@type_info@@QBEPBDXZ");
246 SET(ptype_info_before, "?before@type_info@@QBEHABV1@@Z");
247 SET(ptype_info_opequals_equals, "??8type_info@@QBEHABV0@@Z");
248 SET(ptype_info_opnot_equals, "??9type_info@@QBEHABV0@@Z");
250 SET(p__RTtypeid, "__RTtypeid");
251 SET(p__RTCastToVoid, "__RTCastToVoid");
252 SET(p__RTDynamicCast, "__RTDynamicCast");
254 SET(p__unDName,"__unDName");
256 /* Extremely early versions export logic_error, and crash in RTTI */
257 SETNOFAIL(bAncientVersion, "??0logic_error@@QAE@ABQBD@Z");
261 static void test_exception(void)
263 static const char* e_name = "An exception name";
265 exception e, e2, e3, *pe;
267 if (!poperator_new || !poperator_delete ||
268 !pexception_ctor || !pexception_copy_ctor || !pexception_default_ctor ||
269 !pexception_dtor || !pexception_opequals || !pexception_what ||
270 !pexception_vtable || !pexception_vector_dtor || !pexception_scalar_dtor)
273 /* 'const char*&' ctor */
274 memset(&e, 0, sizeof(e));
275 call_func2(pexception_ctor, &e, &e_name);
276 ok(e.vtable != NULL, "Null exception vtable for e\n");
277 ok(e.name && e.name != e_name && !strcmp(e.name, "An exception name"), "Bad name '%s' for e\n", e.name);
278 ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
281 memset(&e2, 0, sizeof(e2));
282 call_func2(pexception_copy_ctor, &e2, &e);
283 ok(e2.vtable != NULL, "Null exception vtable for e2\n");
284 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n");
285 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
288 memset(&e3, 1, sizeof(e3));
289 call_func1(pexception_default_ctor, &e3);
290 ok(e3.vtable != NULL, "Null exception vtable for e3\n");
291 ok(e3.name == NULL, "Bad exception name for e3\n");
292 ok(e3.do_free == 0, "do_free set to %d for e3\n", e3.do_free);
294 ok(e.vtable == e2.vtable && e.vtable == e3.vtable, "exception vtables differ!\n");
296 /* Test calling the dtors */
297 call_func1(pexception_dtor, &e2);
298 call_func1(pexception_dtor, &e3);
300 /* Operator equals */
301 memset(&e2, 0, sizeof(e2));
302 pe = call_func2(pexception_opequals, &e2, &e);
303 ok(e2.vtable != NULL, "Null exception vtable for e2\n");
304 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n");
305 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
306 ok(pe == &e2, "opequals didn't return e2\n");
309 name = call_func1(pexception_what, &e2);
310 ok(e2.name == name, "Bad exception name from e2::what()\n");
313 ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
314 call_func1(pexception_dtor, &e2);
317 pe = poperator_new(sizeof(exception));
318 ok(pe != NULL, "new() failed\n");
321 call_func2(pexception_ctor, pe, &e_name);
323 call_func2(pexception_scalar_dtor, pe, 0); /* Shouldn't delete pe */
326 call_func2(pexception_scalar_dtor, pe, 1); /* Should delete pe */
329 pe = poperator_new(sizeof(exception));
330 ok(pe != NULL, "new() failed\n");
333 /* vector dtor, single element */
334 call_func2(pexception_ctor, pe, &e_name);
335 call_func2(pexception_vector_dtor, pe, 1); /* Should delete pe as single element*/
338 pe = poperator_new(sizeof(exception) * 4 + sizeof(int));
339 ok(pe != NULL, "new() failed\n");
342 /* vector dtor, multiple elements */
343 char name[] = "a constant";
345 pe = (exception*)((int*)pe + 1);
346 call_func2(pexception_ctor, &pe[0], &e_name);
347 call_func2(pexception_ctor, &pe[1], &e_name);
348 call_func2(pexception_ctor, &pe[2], &e_name);
350 pe[3].do_free = 1; /* Crash if we try to free this */
351 call_func2(pexception_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
354 /* test our exported vtable is kosher */
355 pe = (void*)pexception_vtable; /* Use the exception struct to get vtable ptrs */
356 pexception_vector_dtor = (void*)pe->vtable;
357 pexception_what = (void*)pe->name;
359 name = call_func1(pexception_what, &e);
360 ok(e.name == name, "Bad exception name from vtable e::what()\n");
362 if (p__RTtypeid && !bAncientVersion)
365 type_info *ti = p__RTtypeid(&e);
366 ok (ti && ti->mangled &&
367 !strcmp(ti->mangled, ".?AVexception@@"), "bad rtti for e\n");
371 /* Check the returned type_info has rtti too */
372 type_info *ti2 = p__RTtypeid(ti);
373 ok (ti2 != NULL && !strcmp(ti2->mangled, ".?AVtype_info@@"), "bad rtti for e's type_info\n");
377 call_func2(pexception_vector_dtor, &e, 0); /* Should delete e.name, but not e */
380 /* This test is basically a cut 'n' paste of the exception test. but it verifies that
381 * bad_typeid works the exact same way... */
382 static void test_bad_typeid(void)
384 static const char* e_name = "A bad_typeid name";
386 exception e, e2, e3, *pe;
388 if (!poperator_new || !poperator_delete ||
389 !pbad_typeid_ctor || !pbad_typeid_copy_ctor ||
390 !pbad_typeid_dtor || !pbad_typeid_opequals || !pbad_typeid_what ||
391 !pbad_typeid_vtable || !pbad_typeid_vector_dtor || !pbad_typeid_scalar_dtor)
394 /* 'const char*' ctor */
395 memset(&e, 0, sizeof(e));
396 call_func2(pbad_typeid_ctor, &e, e_name);
397 ok(e.vtable != NULL, "Null bad_typeid vtable for e\n");
398 ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_typeid name"), "Bad name '%s' for e\n", e.name);
399 ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
402 memset(&e2, 0, sizeof(e2));
403 call_func2(pbad_typeid_copy_ctor, &e2, &e);
404 ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n");
405 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad name '%s' for e2\n", e2.name);
406 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
409 if (pbad_typeid_ctor_closure)
411 memset(&e3, 1, sizeof(e3));
412 call_func1(pbad_typeid_ctor_closure, &e3);
413 ok(e3.vtable != NULL, "Null bad_typeid vtable for e3\n");
414 ok(e3.name && !strcmp(e3.name, "bad typeid"), "Bad bad_typeid name for e3\n");
415 ok(e3.do_free == 1, "do_free set to %d for e3\n", e3.do_free);
416 ok(e.vtable == e3.vtable, "bad_typeid closure vtables differ!\n");
417 call_func1(pbad_typeid_dtor, &e3);
419 ok(e.vtable == e2.vtable, "bad_typeid vtables differ!\n");
421 /* Test calling the dtors */
422 call_func1(pbad_typeid_dtor, &e2);
424 /* Operator equals */
425 memset(&e2, 1, sizeof(e2));
426 pe = call_func2(pbad_typeid_opequals, &e2, &e);
427 ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n");
428 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad bad_typeid name for e2\n");
429 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
430 ok(pe == &e2, "opequals didn't return e2\n");
433 name = call_func1(pbad_typeid_what, &e2);
434 ok(e2.name == name, "Bad bad_typeid name from e2::what()\n");
437 ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
438 call_func1(pbad_typeid_dtor, &e2);
441 pe = poperator_new(sizeof(exception));
442 ok(pe != NULL, "new() failed\n");
445 call_func2(pbad_typeid_ctor, pe, e_name);
447 call_func2(pbad_typeid_scalar_dtor, pe, 0); /* Shouldn't delete pe */
450 call_func2(pbad_typeid_scalar_dtor, pe, 1); /* Should delete pe */
453 pe = poperator_new(sizeof(exception));
454 ok(pe != NULL, "new() failed\n");
457 /* vector dtor, single element */
458 call_func2(pbad_typeid_ctor, pe, e_name);
459 call_func2(pbad_typeid_vector_dtor, pe, 1); /* Should delete pe as single element*/
462 pe = poperator_new(sizeof(exception) * 4 + sizeof(int));
463 ok(pe != NULL, "new() failed\n");
466 /* vector dtor, multiple elements */
468 pe = (exception*)((int*)pe + 1);
469 call_func2(pbad_typeid_ctor, &pe[0], e_name);
470 call_func2(pbad_typeid_ctor, &pe[1], e_name);
471 call_func2(pbad_typeid_ctor, &pe[2], e_name);
473 pe[3].do_free = 1; /* Crash if we try to free this element */
474 call_func2(pbad_typeid_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
477 /* test our exported vtable is kosher */
478 pe = (void*)pbad_typeid_vtable; /* Use the exception struct to get vtable ptrs */
479 pbad_typeid_vector_dtor = (void*)pe->vtable;
480 pbad_typeid_what = (void*)pe->name;
482 name = call_func1(pbad_typeid_what, &e);
483 ok(e.name == name, "Bad bad_typeid name from vtable e::what()\n");
485 if (p__RTtypeid && !bAncientVersion)
488 type_info *ti = p__RTtypeid(&e);
489 ok (ti != NULL && !strcmp(ti->mangled, ".?AVbad_typeid@@"), "bad rtti for e (%s)\n",
490 !ti ? "null" : ti->mangled);
493 call_func2(pbad_typeid_vector_dtor, &e, 0); /* Should delete e.name, but not e */
497 /* Ditto for this test... */
498 static void test_bad_cast(void)
500 static const char* e_name = "A bad_cast name";
502 exception e, e2, e3, *pe;
504 if (!poperator_new || !poperator_delete ||
505 !pbad_cast_ctor || !pbad_cast_copy_ctor ||
506 !pbad_cast_dtor || !pbad_cast_opequals || !pbad_cast_what ||
507 !pbad_cast_vtable || !pbad_cast_vector_dtor || !pbad_cast_scalar_dtor)
512 /* 'const char*' ctor */
513 memset(&e, 0, sizeof(e));
514 call_func2(pbad_cast_ctor2, &e, e_name);
515 ok(e.vtable != NULL, "Null bad_cast vtable for e\n");
516 ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_cast name"), "Bad name '%s' for e\n", e.name);
517 ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
518 call_func1(pbad_cast_dtor, &e);
521 /* 'const char*&' ctor */
522 memset(&e, 0, sizeof(e));
523 call_func2(pbad_cast_ctor, &e, &e_name);
524 ok(e.vtable != NULL, "Null bad_cast vtable for e\n");
525 ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_cast name"), "Bad name '%s' for e\n", e.name);
526 ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
529 memset(&e2, 0, sizeof(e2));
530 call_func2(pbad_cast_copy_ctor, &e2, &e);
531 ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n");
532 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad name '%s' for e2\n", e2.name);
533 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
536 if (pbad_cast_ctor_closure)
538 memset(&e3, 1, sizeof(e3));
539 call_func1(pbad_cast_ctor_closure, &e3);
540 ok(e3.vtable != NULL, "Null bad_cast vtable for e3\n");
541 ok(e3.name && !strcmp(e3.name, "bad cast"), "Bad bad_cast name for e3\n");
542 ok(e3.do_free == 1, "do_free set to %d for e3\n", e3.do_free);
543 ok(e.vtable == e3.vtable, "bad_cast closure vtables differ!\n");
544 call_func1(pbad_cast_dtor, &e3);
546 ok(e.vtable == e2.vtable, "bad_cast vtables differ!\n");
548 /* Test calling the dtors */
549 call_func1(pbad_cast_dtor, &e2);
551 /* Operator equals */
552 memset(&e2, 1, sizeof(e2));
553 pe = call_func2(pbad_cast_opequals, &e2, &e);
554 ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n");
555 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad bad_cast name for e2\n");
556 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
557 ok(pe == &e2, "opequals didn't return e2\n");
560 name = call_func1(pbad_cast_what, &e2);
561 ok(e2.name == name, "Bad bad_cast name from e2::what()\n");
564 ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
565 call_func1(pbad_cast_dtor, &e2);
568 pe = poperator_new(sizeof(exception));
569 ok(pe != NULL, "new() failed\n");
572 call_func2(pbad_cast_ctor, pe, &e_name);
574 call_func2(pbad_cast_scalar_dtor, pe, 0); /* Shouldn't delete pe */
577 call_func2(pbad_cast_scalar_dtor, pe, 1); /* Should delete pe */
580 pe = poperator_new(sizeof(exception));
581 ok(pe != NULL, "new() failed\n");
584 /* vector dtor, single element */
585 call_func2(pbad_cast_ctor, pe, &e_name);
586 call_func2(pbad_cast_vector_dtor, pe, 1); /* Should delete pe as single element*/
589 pe = poperator_new(sizeof(exception) * 4 + sizeof(int));
590 ok(pe != NULL, "new() failed\n");
593 /* vector dtor, multiple elements */
595 pe = (exception*)((int*)pe + 1);
596 call_func2(pbad_cast_ctor, &pe[0], &e_name);
597 call_func2(pbad_cast_ctor, &pe[1], &e_name);
598 call_func2(pbad_cast_ctor, &pe[2], &e_name);
600 pe[3].do_free = 1; /* Crash if we try to free this element */
601 call_func2(pbad_cast_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
604 /* test our exported vtable is kosher */
605 pe = (void*)pbad_cast_vtable; /* Use the exception struct to get vtable ptrs */
606 pbad_cast_vector_dtor = (void*)pe->vtable;
607 pbad_cast_what = (void*)pe->name;
609 name = call_func1(pbad_cast_what, &e);
610 ok(e.name == name, "Bad bad_cast name from vtable e::what()\n");
612 if (p__RTtypeid && !bAncientVersion)
615 type_info *ti = p__RTtypeid(&e);
616 ok (ti != NULL && !strcmp(ti->mangled, ".?AVbad_cast@@"), "bad rtti for e\n");
618 call_func2(pbad_cast_vector_dtor, &e, 0); /* Should delete e.name, but not e */
621 /* ... and this one */
622 static void test___non_rtti_object(void)
624 static const char* e_name = "A __non_rtti_object name";
626 exception e, e2, *pe;
628 if (!poperator_new || !poperator_delete ||
629 !p__non_rtti_object_ctor || !p__non_rtti_object_copy_ctor ||
630 !p__non_rtti_object_dtor || !p__non_rtti_object_opequals || !p__non_rtti_object_what ||
631 !p__non_rtti_object_vtable || !p__non_rtti_object_vector_dtor || !p__non_rtti_object_scalar_dtor)
634 /* 'const char*' ctor */
635 memset(&e, 0, sizeof(e));
636 call_func2(p__non_rtti_object_ctor, &e, e_name);
637 ok(e.vtable != NULL, "Null __non_rtti_object vtable for e\n");
638 ok(e.name && e.name != e_name && !strcmp(e.name, "A __non_rtti_object name"), "Bad name '%s' for e\n", e.name);
639 ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
642 memset(&e2, 0, sizeof(e2));
643 call_func2(p__non_rtti_object_copy_ctor, &e2, &e);
644 ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n");
645 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad name '%s' for e2\n", e2.name);
646 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
647 ok(e.vtable == e2.vtable, "__non_rtti_object vtables differ!\n");
649 /* Test calling the dtors */
650 call_func1(p__non_rtti_object_dtor, &e2);
652 /* Operator equals */
653 memset(&e2, 1, sizeof(e2));
654 pe = call_func2(p__non_rtti_object_opequals, &e2, &e);
655 ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n");
656 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad __non_rtti_object name for e2\n");
657 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
658 ok(pe == &e2, "opequals didn't return e2\n");
661 name = call_func1(p__non_rtti_object_what, &e2);
662 ok(e2.name == name, "Bad __non_rtti_object name from e2::what()\n");
665 ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
666 call_func1(p__non_rtti_object_dtor, &e2);
669 pe = poperator_new(sizeof(exception));
670 ok(pe != NULL, "new() failed\n");
673 call_func2(p__non_rtti_object_ctor, pe, e_name);
675 call_func2(p__non_rtti_object_scalar_dtor, pe, 0); /* Shouldn't delete pe */
678 call_func2(p__non_rtti_object_scalar_dtor, pe, 1); /* Should delete pe */
681 pe = poperator_new(sizeof(exception));
682 ok(pe != NULL, "new() failed\n");
685 /* vector dtor, single element */
686 call_func2(p__non_rtti_object_ctor, pe, e_name);
687 call_func2(p__non_rtti_object_vector_dtor, pe, 1); /* Should delete pe as single element*/
690 pe = poperator_new(sizeof(exception) * 4 + sizeof(int));
691 ok(pe != NULL, "new() failed\n");
694 /* vector dtor, multiple elements */
696 pe = (exception*)((int*)pe + 1);
697 call_func2(p__non_rtti_object_ctor, &pe[0], e_name);
698 call_func2(p__non_rtti_object_ctor, &pe[1], e_name);
699 call_func2(p__non_rtti_object_ctor, &pe[2], e_name);
701 pe[3].do_free = 1; /* Crash if we try to free this element */
702 call_func2(p__non_rtti_object_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
705 /* test our exported vtable is kosher */
706 pe = (void*)p__non_rtti_object_vtable; /* Use the exception struct to get vtable ptrs */
707 p__non_rtti_object_vector_dtor = (void*)pe->vtable;
708 p__non_rtti_object_what = (void*)pe->name;
710 name = call_func1(p__non_rtti_object_what, &e);
711 ok(e.name == name, "Bad __non_rtti_object name from vtable e::what()\n");
713 if (p__RTtypeid && !bAncientVersion)
716 type_info *ti = p__RTtypeid(&e);
717 ok (ti != NULL && !strcmp(ti->mangled, ".?AV__non_rtti_object@@"), "bad rtti for e\n");
719 call_func2(p__non_rtti_object_vector_dtor, &e, 0); /* Should delete e.name, but not e */
723 static void test_type_info(void)
725 static type_info t1 = { NULL, NULL,{'.','?','A','V','t','e','s','t','1','@','@',0,0,0,0,0 } };
726 static type_info t1_1 = { NULL, NULL,{'?','?','A','V','t','e','s','t','1','@','@',0,0,0,0,0 } };
727 static type_info t2 = { NULL, NULL, {'.','?','A','V','t','e','s','t','2','@','@',0,0,0,0,0 } };
731 if (!pmalloc || !pfree || !ptype_info_dtor || !ptype_info_raw_name ||
732 !ptype_info_name || !ptype_info_before ||
733 !ptype_info_opequals_equals || !ptype_info_opnot_equals)
736 /* Test calling the dtors */
737 call_func1(ptype_info_dtor, &t1); /* No effect, since name is NULL */
738 t1.name = pmalloc(64);
739 strcpy(t1.name, "foo");
740 call_func1(ptype_info_dtor, &t1); /* Frees t1.name using 'free' */
744 name = call_func1(ptype_info_raw_name, &t1);
746 /* FIXME: This fails on native; it shouldn't though - native bug?
747 * ok(name && !strcmp(name, t1.mangled), "bad raw_name '%s' for t1 (expected '%s')\n", name, t1.mangled);
749 ok(t1.name == NULL, "raw_name() set name for t1\n");
753 name = call_func1(ptype_info_name, &t1);
754 ok(name && t1.name && !strcmp(name, t1.name), "bad name '%s' for t1\n", name);
756 ok(t1.name && !strcmp(t1.name, "class test1"), "demangled to '%s' for t1\n", t1.name);
757 call_func1(ptype_info_dtor, &t1);
761 res = (int)call_func2(ptype_info_before, &t1, &t1);
762 ok(res == 0, "expected 0, got %d\n", res);
763 res = (int)call_func2(ptype_info_before, &t2, &t1);
764 ok(res == 0, "expected 0, got %d\n", res);
765 res = (int)call_func2(ptype_info_before, &t1, &t2);
766 ok(res == 1, "expected 1, got %d\n", res);
767 /* Doesn't check first char */
768 res = (int)call_func2(ptype_info_before, &t1, &t1_1);
769 ok(res == 0, "expected 0, got %d\n", res);
771 /* opequals_equals */
773 res = (int)call_func2(ptype_info_opequals_equals, &t1, &t1);
774 ok(res == 1, "expected 1, got %d\n", res);
775 res = (int)call_func2(ptype_info_opequals_equals, &t1, &t2);
776 ok(res == 0, "expected 0, got %d\n", res);
777 res = (int)call_func2(ptype_info_opequals_equals, &t2, &t1);
778 ok(res == 0, "expected 0, got %d\n", res);
782 res = (int)call_func2(ptype_info_opnot_equals, &t1, &t1);
783 ok(res == 0, "expected 0, got %d\n", res);
784 res = (int)call_func2(ptype_info_opnot_equals, &t1, &t2);
785 ok(res == 1, "expected 1, got %d\n", res);
786 res = (int)call_func2(ptype_info_opnot_equals, &t2, &t1);
787 ok(res == 1, "expected 1, got %d\n", res);
790 /* Test RTTI functions */
791 static void test_rtti(void)
793 static const char* e_name = "name";
798 if (bAncientVersion ||
799 !p__RTCastToVoid || !p__RTtypeid || !pexception_ctor || !pbad_typeid_ctor || !p__RTDynamicCast)
802 call_func2(pexception_ctor, &e, &e_name);
803 call_func2(pbad_typeid_ctor, &b, e_name);
805 /* dynamic_cast to void* */
806 casted = p__RTCastToVoid(&e);
807 ok (casted == (void*)&e, "failed cast to void\n");
809 /* dynamic_cast up */
810 ti = p__RTtypeid(&e);
811 bti = p__RTtypeid(&b);
813 casted = p__RTDynamicCast(&b, 0, NULL, ti, 0);
814 ok (casted == (void*)&b, "failed cast from bad_cast to exception\n");
816 /* dynamic_cast down */
817 casted = p__RTDynamicCast(&e, 0, NULL, bti, 0);
818 ok (casted == NULL, "Cast succeeded\n");
827 static void test_demangle_datatype(void)
830 struct _demangle demangle[]={
831 /* { "BlaBla"," ?? ::Bla", FALSE}, */
832 { "ABVVec4@ref2@dice@@","class dice::ref2::Vec4 const &",TRUE},
833 { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0H@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,7>", TRUE},
834 { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HO@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,126>",TRUE},
835 { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,2016>",TRUE},
836 { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOAA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,32256>",TRUE},
837 { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", FALSE},
838 /* { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@",FALSE}, */
840 int i, num_test = (sizeof(demangle)/sizeof(struct _demangle));
842 for (i = 0; i < num_test; i++)
844 name = p__unDName(0, demangle[i].mangled, 0, pmalloc, pfree, 0x2800);
845 if (demangle[i].test_in_wine)
846 ok(name != NULL && !strcmp(name,demangle[i].result), "Got name \"%s\" for %d\n", name, i);
848 todo_wine ok(name != NULL && !strcmp(name,demangle[i].result), "Got name %s for %d\n", name, i);
853 /* Compare two strings treating multiple spaces (' ', ascii 0x20) in s2
854 as single space. Needed for test_demangle as __unDName() returns sometimes
855 two spaces instead of one in some older native msvcrt dlls. */
856 static int strcmp_space(const char *s1, const char *s2)
858 const char* s2start = s2;
860 while (*s1 == *s2 && *s1) {
864 if (*s2 == ' ' && s2 > s2start && *(s2 - 1) == ' ')
868 } while (*s1 && *s2);
872 static void test_demangle(void)
874 static struct {const char* in; const char* out;} test[] = {
875 {"??0bad_alloc@std@@QAE@ABV01@@Z", "public: __thiscall std::bad_alloc::bad_alloc(class std::bad_alloc const &)"},
876 {"??0bad_alloc@std@@QAE@PBD@Z", "public: __thiscall std::bad_alloc::bad_alloc(char const *)"},
877 {"??0bad_cast@@AAE@PBQBD@Z", "private: __thiscall bad_cast::bad_cast(char const * const *)"},
878 {"??0bad_cast@@QAE@ABQBD@Z", "public: __thiscall bad_cast::bad_cast(char const * const &)"},
879 {"??0bad_cast@@QAE@ABV0@@Z", "public: __thiscall bad_cast::bad_cast(class bad_cast const &)"},
880 {"??0bad_exception@std@@QAE@ABV01@@Z", "public: __thiscall std::bad_exception::bad_exception(class std::bad_exception const &)"},
881 {"??0bad_exception@std@@QAE@PBD@Z", "public: __thiscall std::bad_exception::bad_exception(char const *)"},
882 {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@ABV01@@Z", "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 &)"},
883 {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z", "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(struct _iobuf *)"},
884 {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z", "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(enum std::_Uninitialized)"},
885 {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@ABV01@@Z", "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 &)"},
886 {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z", "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 *)"},
887 {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z", "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)"},
888 {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z", "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 &)"},
889 {"??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", "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)"},
890 {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z", "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)"},
891 {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV01@@Z", "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 &)"},
892 {"??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", "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)"},
893 {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z", "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)"},
894 {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z", "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)"},
895 {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z", "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)"},
896 {"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@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> > >(class std::_Locinfo const &,unsigned int)"},
897 {"??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)"},
898 {"??0streambuf@@QAE@ABV0@@Z", "public: __thiscall streambuf::streambuf(class streambuf const &)"},
899 {"??0strstreambuf@@QAE@ABV0@@Z", "public: __thiscall strstreambuf::strstreambuf(class strstreambuf const &)"},
900 {"??0strstreambuf@@QAE@H@Z", "public: __thiscall strstreambuf::strstreambuf(int)"},
901 {"??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z", "public: __thiscall strstreambuf::strstreambuf(void * (__cdecl*)(long),void (__cdecl*)(void *))"},
902 {"??0strstreambuf@@QAE@PADH0@Z", "public: __thiscall strstreambuf::strstreambuf(char *,int,char *)"},
903 {"??0strstreambuf@@QAE@PAEH0@Z", "public: __thiscall strstreambuf::strstreambuf(unsigned char *,int,unsigned char *)"},
904 {"??0strstreambuf@@QAE@XZ", "public: __thiscall strstreambuf::strstreambuf(void)"},
905 {"??1__non_rtti_object@std@@UAE@XZ", "public: virtual __thiscall std::__non_rtti_object::~__non_rtti_object(void)"},
906 {"??1__non_rtti_object@@UAE@XZ", "public: virtual __thiscall __non_rtti_object::~__non_rtti_object(void)"},
907 {"??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)"},
908 {"??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)"},
909 {"??4istream_withassign@@QAEAAV0@ABV0@@Z", "public: class istream_withassign & __thiscall istream_withassign::operator=(class istream_withassign const &)"},
910 {"??4istream_withassign@@QAEAAVistream@@ABV1@@Z", "public: class istream & __thiscall istream_withassign::operator=(class istream const &)"},
911 {"??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z", "public: class istream & __thiscall istream_withassign::operator=(class streambuf *)"},
912 {"??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 &)"},
913 {"??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 &)"},
914 {"??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 &)"},
915 {"??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 &))"},
916 {"??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> > *)"},
917 {"??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 *)"},
918 {"??_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> >'}"},
919 {"??_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> >'}"},
920 {"??_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> >'}"},
921 {"??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 &)"},
922 {"??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 &)"},
923 {"??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)"},
924 {"??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 "},
925 {"??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)"},
926 {"??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 "},
927 {"?abs@std@@YAMABV?$complex@M@1@@Z", "float __cdecl std::abs(class std::complex<float> const &)"},
928 {"?abs@std@@YANABV?$complex@N@1@@Z", "double __cdecl std::abs(class std::complex<double> const &)"},
929 {"?abs@std@@YAOABV?$complex@O@1@@Z", "long double __cdecl std::abs(class std::complex<long double> const &)"},
930 {"?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A", "class std::basic_istream<char,struct std::char_traits<char> > std::cin"},
931 {"?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 "},
932 {"?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 "},
933 {"?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 "},
934 {"?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 "},
935 {"?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 "},
936 {"?_query_new_handler@@YAP6AHI@ZXZ", "int (__cdecl*__cdecl _query_new_handler(void))(unsigned int)"},
937 {"?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)"},
938 {"?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)"},
939 {"?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>)"},
940 {"?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)"},
941 {"?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>)"},
942 {"?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)"},
943 {"?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)"},
944 {"?set_new_handler@@YAP6AXXZP6AXXZ@Z", "void (__cdecl*__cdecl set_new_handler(void (__cdecl*)(void)))(void)"},
945 {"?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 &)"},
946 {"?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 "},
947 {"?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 &)"},
948 {"?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 "},
949 {"?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 &)"},
950 {"?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 "},
951 {"?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 &)"},
952 {"?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 "},
953 {"?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 &)"},
954 {"?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 "},
955 {"?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 &)"},
956 {"?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 "},
957 {"?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 &)"},
958 {"?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 "},
959 {"?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 &)"},
960 {"?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 "},
961 {"?_Sync@ios_base@std@@0_NA", "private: static bool std::ios_base::_Sync"},
962 {"??_U@YAPAXI@Z", "void * __cdecl operator new[](unsigned int)"},
963 {"??_V@YAXPAX@Z", "void __cdecl operator delete[](void *)"},
964 {"??X?$_Complex_base@M@std@@QAEAAV01@ABM@Z", "public: class std::_Complex_base<float> & __thiscall std::_Complex_base<float>::operator*=(float const &)"},
965 {"??Xstd@@YAAAV?$complex@M@0@AAV10@ABV10@@Z", "class std::complex<float> & __cdecl std::operator*=(class std::complex<float> &,class std::complex<float> const &)"},
966 {"?aaa@@YAHAAUbbb@@@Z", "int __cdecl aaa(struct bbb &)"},
967 {"?aaa@@YAHBAUbbb@@@Z", "int __cdecl aaa(struct bbb & volatile)"},
968 {"?aaa@@YAHPAUbbb@@@Z", "int __cdecl aaa(struct bbb *)"},
969 {"?aaa@@YAHQAUbbb@@@Z", "int __cdecl aaa(struct bbb * const)"},
970 {"?aaa@@YAHRAUbbb@@@Z", "int __cdecl aaa(struct bbb * volatile)"},
971 {"?aaa@@YAHSAUbbb@@@Z", "int __cdecl aaa(struct bbb * const volatile)"},
972 {"??0aa.a@@QAE@XZ", "??0aa.a@@QAE@XZ"},
973 {"??0aa$_3a@@QAE@XZ", "public: __thiscall aa$_3a::aa$_3a(void)"},
974 {"??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)"},
975 {"?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 *))"},
977 int i, num_test = (sizeof(test)/sizeof(test[0]));
980 for (i = 0; i < num_test; i++)
982 name = p__unDName(0, test[i].in, 0, pmalloc, pfree, 0);
983 ok(name != NULL && !strcmp_space(test[i].out, name),
984 "Got name \"%s\" for %d\n", name, i);
996 test___non_rtti_object();
999 test_demangle_datatype();
1003 FreeLibrary(hMsvcrt);
1005 #endif /* __i386__ */