The code for void* correct. the void** type is void** to void* .
Code int* p = (int*) &p; by itself is correct, because although &p is of type int** , but it can be cast to int* via reinterpret_cast (C-style cast in this case).
However, p can not be dereferenced, because this would be a violation of the rules of alising 'a : p actually points to an object of type int* , and the expression *p treats this object as int .
(And of course the result of such a reinterpret_cast cannot be dereferenced due to the rules of the reinterpret_cast itself, but the question was about aliasing .)
strict aliasingtherefore, he doubted. Although I do not see him. - Vladimir Gamalyan