From: Jonathan Wakely Date: Thu, 23 Oct 2014 21:07:49 +0000 (+0100) Subject: re PR c++/63619 (warning: deleting ‘void*’ is undefined has no -W flag) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=53b0f7471aadaff6b3762039413d6265c06ef3b2;p=gcc.git re PR c++/63619 (warning: deleting ‘void*’ is undefined has no -W flag) 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e5667506b6a..f741bfb6036 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-10-23 Jonathan Wakely + + PR c++/63619 + * decl2.c (delete_sanity): Use OPT_Wdelete_incomplete in warning. + 2014-10-21 Paolo Carlini * parser.c (cp_parser_unary_expression): Add default arguments. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4be48479ad0..60c8a63e1b9 100644 --- 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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e5105419355..88e08e0442e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-10-23 Jonathan Wakely + + PR c++/63619 + * g++.dg/warn/Wdelete-incomplete-3.C: New. + * g++.dg/warn/Wdelete-incomplete-4.C: New. + 2014-10-23 Evgeny Stupachenko 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 index 00000000000..2202d60a6f2 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C @@ -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 index 00000000000..f2eb5ba079f --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C @@ -0,0 +1,7 @@ +// PR c++/63619 +// { dg-options -Wno-delete-incomplete } + +int main() { + void* p; + delete p; +}