summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr68470.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/torture/pr68470.C')
-rw-r--r--gcc/testsuite/g++.dg/torture/pr68470.C36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/torture/pr68470.C b/gcc/testsuite/g++.dg/torture/pr68470.C
new file mode 100644
index 00000000000..5dd558d15d2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr68470.C
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+
+void deallocate(void *);
+void *a;
+
+struct C {
+ virtual void m_fn1();
+};
+
+struct D {
+ C *m_fn2() {
+ if (a)
+ __builtin_abort();
+ }
+};
+D getd();
+
+struct vec_int {
+ int _M_start;
+ ~vec_int() {
+ if (_M_start)
+ deallocate(&_M_start);
+ }
+};
+vec_int *b;
+
+struct I {
+ virtual void m_fn3();
+};
+
+void I::m_fn3() {
+ if (a)
+ getd().m_fn2()->m_fn1();
+ b->~vec_int();
+}
+