C standard say that's not safe. You can force that to be safe inC-GCC if you explicitly disable a compiler optimization. I think D docs don't say anything about this. And Walter has said that regarding such things D acts as C. So I am not sure that will be safe in future D.
Unions are not allowed in SafeD, so I guess they are considered unsafe in D.
