[Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag

2014-10-23 Thread fuscated at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619

--- Comment #4 from Teodor Petrov fuscated at gmail dot com ---
FYI: clang fixed the same issue by adding it to -Wdelete-incomplete


[Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag

2014-10-23 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619

--- Comment #5 from Jonathan Wakely redi at gcc dot gnu.org ---
Author: redi
Date: Thu Oct 23 21:07:49 2014
New Revision: 216599

URL: https://gcc.gnu.org/viewcvs?rev=216599root=gccview=rev
Log:
PR c++/63619

gcc/cp:
PR c++/63619
* decl2.c (delete_sanity): Use OPT_Wdelete_incomplete in warning.

gcc/testsuite:
PR c++/63619
* g++.dg/warn/Wdelete-incomplete-3.C: New.
* g++.dg/warn/Wdelete-incomplete-4.C: New.

Added:
trunk/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C
trunk/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl2.c
trunk/gcc/testsuite/ChangeLog


[Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag

2014-10-23 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619

Jonathan Wakely redi at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |5.0

--- Comment #6 from Jonathan Wakely redi at gcc dot gnu.org ---
Fixed on trunk.


[Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag

2014-10-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619

Jonathan Wakely redi at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||diagnostic
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-10-22
 Ever confirmed|0   |1

--- Comment #1 from Jonathan Wakely redi at gcc dot gnu.org ---
Yes, this is a very good candidate for wanting a -Werror=xxx option


[Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag

2014-10-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619

--- Comment #2 from Jonathan Wakely redi at gcc dot gnu.org ---
The simplest fix would be:

--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -478,7 +478,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int
use_global_delete,
   /* Deleting ptr to void is undefined behavior [expr.delete/3].  */
   if (VOID_TYPE_P (TREE_TYPE (type)))
 {
-  warning (0, deleting %qT is undefined, type);
+  warning (OPT_Wdelete_incomplete, deleting %qT is undefined, type);
   doing_vec = 0;
 }

Although it's possible someone would want deleting void to be an error but not
deleting an incomplete type (because it's only undefined to delete an
incomplete type if it has a non-trivial destructor or a custom deallocation
function).


[Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag

2014-10-22 Thread fuscated at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619

--- Comment #3 from Teodor Petrov fuscated at gmail dot com ---
We already use -Werror=delete-incomplete, so it will be easier for us, because
it will just work.

But if you ask me (as a user) it is best to just change the standard to force
these two as errors. I know this will never happen, but I have to murmur about
it.

BTW: Thanks for looking at this in such a short time :)