     mark_present_for_each<T> f;
     f.ptr = thrust::raw_pointer_cast(output.data());
 
-    thrust::for_each(input.begin(), input.end(), f);
+    typename Vector::iterator result = thrust::for_each(input.begin(), input.end(), f);
 
     ASSERT_EQUAL(output[0], 0);
     ASSERT_EQUAL(output[1], 0);

    mark_present_for_each<int> f;
    f.ptr = thrust::raw_pointer_cast(output.data());

    thrust::for_each(thrust::make_counting_iterator(0), thrust::make_counting_iterator(5), f);

    ASSERT_EQUAL(output[0], 1);
    ASSERT_EQUAL(output[1], 1);

    ASSERT_EQUAL(output[4], 1);
    ASSERT_EQUAL(output[5], 0);
    ASSERT_EQUAL(output[6], 1);
    ASSERT_EQUAL_QUIET(result, input.end());
}
DECLARE_VECTOR_UNITTEST(TestForEachSimple);

