char mem[8];
uint64_t *memory{(uint64_t*)(void*)&mem[0]};
std::cout << "diff: " << (void*)memory - (void*)(&mem[0]) << std::endl;
Trivial example, error message with gcc is:
error: invalid use of ‘void’
std::cout << "diff: " << (void*)memory - (void*)(&mem[0]) << std::endl;