view tango-0.99.9.patch @ 1638:0de4525a9ed6

Apply workaround for #395 by klickverbot.
author Christian Kamm <kamm incasoftware de>
date Mon, 08 Mar 2010 20:06:08 +0100
parents 5c0cebff9be8
children 40bd4a0d4870
line wrap: on
line source
Index: tango/core/rt/compiler/ldc/rt/lifetime.d
===================================================================
--- tango/core/rt/compiler/ldc/rt/lifetime.d	(revision 5368)
+++ tango/core/rt/compiler/ldc/rt/lifetime.d	(working copy)
@@ -786,6 +786,7 @@
     return *cast(long*)px;
 }
 
++/
 
 /**
  *
@@ -849,10 +850,11 @@
 
 
 /**
- *
+ * Appends a single element to an array.
  */
-extern (C) byte[] _d_arrayappendcT(TypeInfo ti, ref byte[] x, ...)
+extern (C) byte[] _d_arrayappendcT(TypeInfo ti, void* array, void* element)
 {
+    auto x = cast(byte[]*)array;
     auto sizeelem = ti.next.tsize();            // array element size
     auto info = gc_query(x.ptr);
     auto length = x.length;
@@ -879,16 +881,16 @@
         assert(newcap >= newlength * sizeelem);
         newdata = cast(byte *)gc_malloc(newcap + 1, info.attr);
         memcpy(newdata, x.ptr, length * sizeelem);
-        (cast(void**)(&x))[1] = newdata;
+        (cast(void**)x)[1] = newdata;
     }
   L1:
-    byte *argp = cast(byte *)(&ti + 2);
+    byte *argp = cast(byte *)element;
 
-    *cast(size_t *)&x = newlength;
+    *cast(size_t *)x = newlength;
     x.ptr[length * sizeelem .. newsize] = argp[0 .. sizeelem];
     assert((cast(size_t)x.ptr & 15) == 0);
     assert(gc_sizeOf(x.ptr) > x.length * sizeelem);
-    return x;
+    return *x;
 }
 
 
@@ -1128,6 +1130,7 @@
     return result;
 }
 
+/+
 
 /**
  *