ClangSharp icon indicating copy to clipboard operation
ClangSharp copied to clipboard

Error: arithmetic on a pointer to void

Open uberhalit opened this issue 4 years ago • 1 comments

Void pointer artihmetic throws an error:

void *cpy(void *dest, const void *src, size_t n);
static bool exec(void *buf, size_t size, void *info, size_t size2) {
    memcpy(buf + size * size2++, info, size);
    return true;
}

ClangSharpPInvokeGenerator:

Diagnostics for '.\test.h':
    .\test.h:12:25: error: arithmetic on a pointer to void

uberhalit avatar Nov 19 '21 23:11 uberhalit

This should hopefully be a fairly trivial fix.

Just another scenario where C/C++ allow an implicit conversion that C# does not and so the explicit casts need to be inserted instead.

tannergooding avatar Nov 21 '21 17:11 tannergooding