re PR c++/63619 (warning: deleting ‘void*’ is undefined has no -W flag)
authorJonathan Wakely <jwakely@redhat.com>
Thu, 23 Oct 2014 21:07:49 +0000 (22:07 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 23 Oct 2014 21:07:49 +0000 (22:07 +0100)
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.

From-SVN: r216599

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C [new file with mode: 0644]

index e5667506b6ac97fe44669152b153e1ca7cebba88..f741bfb603601702a4794d827f565807bd295d14 100644 (file)
@@ -1,3 +1,8 @@
+2014-10-23  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR c++/63619
+       * decl2.c (delete_sanity): Use OPT_Wdelete_incomplete in warning.
+
 2014-10-21  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * parser.c (cp_parser_unary_expression): Add default arguments.
index 4be48479ad076f994bfbf5b85466cf72fe039d5b..60c8a63e1b97ae696694121904df69821c0a1e48 100644 (file)
@@ -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;
     }
 
index e5105419355aa5fea5d7b129dd4bd10ceda3e0ad..88e08e0442e6d4c92b3f1ed0a640541e4f4a94be 100644 (file)
@@ -1,3 +1,9 @@
+2014-10-23  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR c++/63619
+       * g++.dg/warn/Wdelete-incomplete-3.C: New.
+       * g++.dg/warn/Wdelete-incomplete-4.C: New.
+
 2014-10-23  Evgeny Stupachenko  <evstupac@gmail.com>
 
        PR target/63618
diff --git a/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C b/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C
new file mode 100644 (file)
index 0000000..2202d60
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/63619
+
+int main() {
+   void* p;
+   delete p;    // { dg-warning "undefined" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C b/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C
new file mode 100644 (file)
index 0000000..f2eb5ba
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/63619
+// { dg-options -Wno-delete-incomplete }
+
+int main() {
+   void* p;
+   delete p;
+}