Q:

OpenCL enqueueWriteImage no const void* ptr in C++ wrapper but in C function

In cl2.hpp enqueueWriteImage takes a void* ptr but calls the C function clEnqueueWriteImage which takes a const void* ptr. Why is that?
cl_int enqueueWriteImage(
    const Image& image,
    cl_bool blocking,
    const array<size_type, 3>& origin,
    const array<size_type, 3>& region,
    size_type row_pitch,
    size_type slice_pitch,
    void* ptr,
    const vector<Event>* events = NULL,
    Event* event = NULL) const
{
    cl_event tmp;
    cl_int err = detail::errHandler(
        ::clEnqueueWriteImage(//... here the const void* ptr appears

Is this intended or a typo? Because it is only calling a function that accepts a const void* ptr so it could be const, too.

A:

You are correct; this is a bug in the OpenCL C++ bindings. There were a few other enqueueWrite* functions with this same issue. I've pushed a fix to the Khronos GitHub repository for these headers - it will be included in the next release.

