diff --git a/src/Vector/cuda/vector_dist_cuda_funcs.cuh b/src/Vector/cuda/vector_dist_cuda_funcs.cuh
index b30f98041ee8da607a006c08833a3553b4f5cbea..1cbaecc0977b8ee22c844ead8f4d9e0d6309dc5d 100644
--- a/src/Vector/cuda/vector_dist_cuda_funcs.cuh
+++ b/src/Vector/cuda/vector_dist_cuda_funcs.cuh
@@ -406,7 +406,7 @@ void remove_marked(vector_type & vd)
 	// we reuse memory. this give us the possibility to avoid allocation and make the remove faster
 
 	vd_pos_new.setMemory(exp_tmp);
-	vd_prp_new.setMemoryArray(&exp_tmp2);
+	vd_prp_new.setMemoryArray((CudaMemory *)&exp_tmp2);
 
 	// resize them