commit 9066b282eed98c3ba62f04ff9338b3772c04224e
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Oct 23 18:11:22 2014 +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.
@@ -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;
}
new file mode 100644
@@ -0,0 +1,6 @@
+// PR c++/63619
+
+int main() {
+ void* p;
+ delete p; // { dg-warning "undefined" }
+}
new file mode 100644
@@ -0,0 +1,7 @@
+// PR c++/63619
+// { dg-options -Wno-delete-incomplete }
+
+int main() {
+ void* p;
+ delete p;
+}