You are not forbidden to do that. C++ usually allows you to shot yourself in the foot. It just will not work as expected so you should only do it if you know what you are doing.

Is there any conrete example where you would need that? If you need it, you very likely try to use the API in a wrong way.