Mercurial > projects > dstress
annotate run/t/typeinfo_03_B.d @ 1449:6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
Madeleine Freudenberg <madou@madou.org>
2007-04-01
http://d.puremagic.com/issues/show_bug.cgi?id=1089
author | thomask |
---|---|
date | Wed, 04 Apr 2007 20:29:33 +0000 |
parents | |
children | b5c0842014ef |
rev | line source |
---|---|
1449
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
1 // $HeadURL$ |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
2 // $Date$ |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
3 // $Author$ |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
4 |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
5 // @author@ Madeleine Freudenberg <madou@madou.org> |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
6 // @date@ 2007-04-01 |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
7 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1089 |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
8 // @desc@ [Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
9 |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
10 module dstress.run.t.typeinfo_03_B; |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
11 |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
12 int main(){ |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
13 TypeInfo_Pointer t = new TypeInfo_Pointer(); |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
14 t.m_next = typeid(int); |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
15 |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
16 int* a = new int; |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
17 int* b = new int; |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
18 *a = -10; |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
19 *b = int.max; |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
20 |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
21 if(-1 < t.compare(a, b)){ |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
22 assert(0); |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
23 } |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
24 if(t.compare(b, a) < 1){ |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
25 assert(0); |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
26 } |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
27 |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
28 return 0; |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
29 } |
6666662e4363
[Issue 1089] Unsafe pointer comparison in TypeInfo_Pointer.compare
thomask
parents:
diff
changeset
|
30 |