[Bug c++/85858] -Weffc++ should not require copy ctor for const pointers

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 21 20:04:00 GMT 2018


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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Nope, see the C++ standard:

  [ Note: A pointer to a const type can be the operand of a delete-expression;
  it is not necessary to cast away the constness (8.5.1.11) of the pointer
  expression before it is used as the operand of the delete-expression. — end
  note ]

The deallocation function 'operator delete(void*)' is not the same as a
delete-expression such as delete[] p.


More information about the Gcc-bugs mailing list