aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-05-03 19:35:20 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-05-03 19:35:20 -0400
commit9cbc7d65710edb891cb8fef8e1780491c7552a61 (patch)
tree06bd2cb55e4e0ae66afac95e9716ce1aaab34b44 /gcc/testsuite/g++.dg
parent86f66562b73c61ae927b301d5dd907d7564c2e3f (diff)
downloadgcc-9cbc7d65710edb891cb8fef8e1780491c7552a61.zip
gcc-9cbc7d65710edb891cb8fef8e1780491c7552a61.tar.gz
gcc-9cbc7d65710edb891cb8fef8e1780491c7552a61.tar.bz2
PR c++/85600 - virtual delete failure.
* init.c (build_delete): Always save_expr when deleting. From-SVN: r259913
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/expr/delete2.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/expr/delete2.C b/gcc/testsuite/g++.dg/expr/delete2.C
new file mode 100644
index 0000000..a0fc179
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/delete2.C
@@ -0,0 +1,25 @@
+// PR c++/85600
+// { dg-do run }
+
+struct A
+{
+ virtual ~A() { }
+};
+
+struct B: A { };
+
+A *p;
+int count;
+
+A *f() {
+ ++count;
+ return p;
+}
+
+int main()
+{
+ p = new B;
+ delete f();
+ if (count != 1)
+ __builtin_abort();
+}