diff options
author | Jason Merrill <jason@redhat.com> | 2018-05-03 19:35:20 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-05-03 19:35:20 -0400 |
commit | 9cbc7d65710edb891cb8fef8e1780491c7552a61 (patch) | |
tree | 06bd2cb55e4e0ae66afac95e9716ce1aaab34b44 /gcc/testsuite/g++.dg | |
parent | 86f66562b73c61ae927b301d5dd907d7564c2e3f (diff) | |
download | gcc-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.C | 25 |
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(); +} |