From 53b0f7471aadaff6b3762039413d6265c06ef3b2 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 23 Oct 2014 22:07:49 +0100 Subject: [PATCH] =?utf8?q?re=20PR=20c++/63619=20(warning:=20deleting=20?= =?utf8?q?=E2=80=98void*=E2=80=99=20is=20undefined=20has=20no=20-W=20flag)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 5 +++++ gcc/cp/decl2.c | 2 +- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C | 6 ++++++ gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C | 7 +++++++ 5 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C create mode 100644 gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C 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; +} -- 2.30.2