aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@gcc.gnu.org>2015-12-18 02:25:39 +0000
committerPatrick Palka <ppalka@gcc.gnu.org>2015-12-18 02:25:39 +0000
commit458cd4c394dec8e42ff75ecd5212461408962203 (patch)
tree53117fe8689b59a9be703212885448c929b1aaab /gcc
parent474c8a0757edd6f650220dcba31b69dcb83c4b73 (diff)
downloadgcc-458cd4c394dec8e42ff75ecd5212461408962203.zip
gcc-458cd4c394dec8e42ff75ecd5212461408962203.tar.gz
gcc-458cd4c394dec8e42ff75ecd5212461408962203.tar.bz2
Fix PR c++/68831 (superfluous -Waddress warning for C++ delete)
gcc/cp/ChangeLog: PR c++/68831 * init.c (build_delete): Use a warning sentinel to disable -Waddress warnings when building the conditional that tests if the operand is NULL. gcc/testsuite/ChangeLog: PR c++/68831 * g++.dg/pr68831.C: New test. From-SVN: r231798
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/init.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/pr68831.C9
4 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4c7dc78..89c0a19 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2015-12-18 Patrick Palka <ppalka@gcc.gnu.org>
+
+ PR c++/68831
+ * init.c (build_delete): Use a warning sentinel to disable
+ -Waddress warnings when building the conditional that tests
+ if the operand is NULL.
+
2015-12-17 Jason Merrill <jason@redhat.com>
PR c++/67550
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index b7f10a1..1d5cc65 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -4449,6 +4449,7 @@ build_delete (tree otype, tree addr, special_function_kind auto_delete,
else
{
/* Handle deleting a null pointer. */
+ warning_sentinel s (warn_address);
ifexp = fold (cp_build_binary_op (input_location,
NE_EXPR, addr, nullptr_node,
complain));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index baa159d..f991a69 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-18 Patrick Palka <ppalka@gcc.gnu.org>
+
+ PR c++/68831
+ * g++.dg/pr68831.C: New test.
+
2015-12-17 Jeff Law <law@redhat.com>
* gcc.dg/tree-ssa/split-path-1.c: Explicitly ask for path
diff --git a/gcc/testsuite/g++.dg/pr68831.C b/gcc/testsuite/g++.dg/pr68831.C
new file mode 100644
index 0000000..2a354a5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr68831.C
@@ -0,0 +1,9 @@
+// PR c++/68831
+// { dg-options "-Waddress" }
+
+class DenseMap {
+public:
+ ~DenseMap();
+};
+extern const DenseMap &GCMap;
+void foo() { delete &GCMap; }