Mercurial > projects > ldc
comparison tests/mini/bug34.d @ 341:1bb99290e03a trunk
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 02:51:19 +0200 |
parents | test/bug34.d@2c3cd3596187 |
children |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 module bug34; | |
2 | |
3 class MyTypeInfo_Pointer | |
4 { | |
5 char[] toString() { return m_next.toString() ~ "*"; } | |
6 | |
7 int opEquals(Object o) | |
8 { TypeInfo_Pointer c; | |
9 | |
10 return this is o || | |
11 ((c = cast(TypeInfo_Pointer)o) !is null && | |
12 this.m_next == c.m_next); | |
13 } | |
14 | |
15 hash_t getHash(void *p) | |
16 { | |
17 return cast(uint)*cast(void* *)p; | |
18 } | |
19 | |
20 int equals(void *p1, void *p2) | |
21 { | |
22 return cast(int)(*cast(void* *)p1 == *cast(void* *)p2); | |
23 } | |
24 | |
25 int compare(void *p1, void *p2) | |
26 { | |
27 if (*cast(void* *)p1 < *cast(void* *)p2) | |
28 return -1; | |
29 else if (*cast(void* *)p1 > *cast(void* *)p2) | |
30 return 1; | |
31 else | |
32 return 0; | |
33 } | |
34 | |
35 size_t tsize() | |
36 { | |
37 return (void*).sizeof; | |
38 } | |
39 | |
40 void swap(void *p1, void *p2) | |
41 { void* tmp; | |
42 tmp = *cast(void**)p1; | |
43 *cast(void**)p1 = *cast(void**)p2; | |
44 *cast(void**)p2 = tmp; | |
45 } | |
46 | |
47 TypeInfo next() { return m_next; } | |
48 uint flags() { return 1; } | |
49 | |
50 TypeInfo m_next; | |
51 } | |
52 | |
53 void main() | |
54 { | |
55 } |