Before answering, let me say: do not try to disable the micro-optimization of your compiler / library. Compiler authors will win something like 99 times out of 100. Use std::copy or memcpy depending on the types that you copy and need.
Other answers noted that you can resolve immediate compilation errors with temporary variables.
I do not recommend this under any circumstances do the following, but I believe that you can also accomplish this by casting to a reference type:
void FrMemCopy(void *to, const void *from, size_t sz) { size_t sz8 = sz >> 3; size_t sz1 = sz - (sz8 << 3); while (sz8-- != 0) { *((double *&)to)++ = *((double *&)from)++; } while (sz1-- != 0) { *((char *&)to)++ = *((char *&)from)++; } }
source share