http://dpaste.dzfl.pl/6001f46873fd On my 32-bit x86 system (DMD v2.068.2), the results are slightly different from dpaste's compiler: struct HandleT { size_t Val; }; void main() { auto h1 = HandleT( cast(const void*) 1 ); // allowed auto h2 = HandleT( cast(void*) 1 ); // allowed auto p1 = cast(const void*) 1; auto h3 = HandleT( p1 ); // allowed auto p2 = cast(void*) 1; auto h4 = HandleT( p2 ); // rejected }; const(void*) is allowed but void* is rejected O.o Obviously none of these expressions should compile.
Related: http://dpaste.dzfl.pl/68de69a294c3
(In reply to Cauterite from comment #0) > auto p1 = cast(const void*) 1; > auto h3 = HandleT( p1 ); // allowed This was disallowed by the time of v2.068.2. onlineapp.d(11): Error: cannot implicitly convert expression `cast(const(void*))cast(size_t)1LU` of type `const(void*)` to `ulong` > Related: http://dpaste.dzfl.pl/68de69a294c3 Server not responding.