https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858

--- Comment #4 from Mike Sharov <msharov at users dot sourceforge.net> ---
(In reply to Jonathan Wakely from comment #3)
> Nothing stops you deallocating a const pointer.

According to http://en.cppreference.com/w/cpp/memory/new/operator_delete
The delete operator takes a void* and attempting to delete a const pointer
would require a const_cast. This is logical, since freeing a memory block is a
modification operation that changes the block's contents by marking it invalid.

To my surprise, I found that g++ actually does currently accept delete of a
const pointer. I believe that should be a bug.

Reply via email to